Realm: Swift `let` property cannot be marked as dynamic -
i using xcode 7.2, swift 2.1.1. have realm model object below
class b: object { dynamic let lists = list<a>() }
but swift compiler gives me error saying:
property cannot marked dynamic because type cannot represented in objective-c
i saw realm's documentation says:
realm model properties need dynamic var attribute in order these properties become accessors underlying database data.
there 2 exceptions this: list , realmoptional properties cannot declared dynamic because generic properties cannot represented in objective-c runtime, used dynamic dispatch of dynamic properties, , should declared
let
but declaring let
doesn't seem solve case now. missing?
the documentation quoted includes following (emphasis mine):
list , realmoptional properties cannot declared dynamic because generic properties cannot represented in objective-c runtime, […], , should declared
let
.
this means property should declared so:
let lists = list<a>()
the realm swift documentation gained property declaration cheatsheet clarifies requirements different types of declarations.
Comments
Post a Comment