I have a lazy var in Swift like:
import Realm
class DataUser: RLMObject {
@objc dynamic lazy var id: String = self.myId()
@objc dynamic var firstTime: Int = 0
@objc dynamic var position: Int = 0
private func myId() -> String {
return “\(firstTime)\(position)”
}
I’m getting this message:
** Terminating app due to uncaught exception 'RLMException', reason: 'Lazy managed property 'id' is not allowed on a Realm Swift object class. Either add the property to the ignored properties list or make it non-lazy.'
What is the correct way to use a lazy-variable in Swift and Realm?
Thanks!