class Ticket: Object {
@objc dynamic var ticketId = ""
@objc dynamic var ticketTypeCode = ""
@objc dynamic var price = ""
required init()
{
super.init()
}
required init(value: Any, schema: RLMSchema)
{
super.init(value: value, schema: schema)
}
required init(realm: RLMRealm, schema: RLMObjectSchema)
{
super.init(realm: realm, schema: schema)
}
here's my model class. the problem is that when I try to save data in realm realm is nil. if let realm = Realm() - here realm is nil. if I remove @objc dynamic from properties realm is'n nil any more, but in that case I can't save data. Can someone help me?