I have checked the related article with this problem. Issue in adding data in Realm in iOS
It seems only issue the previous post that folks were not adding dynamic to variables. that is not my case. I am not finding any other reason at all why it would fail.
Build target 12.2, swift version: Swift 5, realm version: swift-10.2.1
my class:
class Person: Object {
dynamic var id = UUID().uuidString
dynamic var name = ""
}
This is how I am trying to add to the realm
let realm = try! Realm()
let person = Person()
person.name = "John Doe"
try! realm.write {
realm.add(person)
}
Any pointers or suggestion would be appreciated. Thanks a lot for reading the post.