@Persisted vs @objc dynamic var

What is the difference between @Persisted vs @objc dynamic var

I noticed that when I use @Persisted on a list, object appended to it are not added on my realm and I have to add it manually.

I am suspecting that this could be related to id.

@objc dynamic var _id = ObjectId.generate()
@Persisted(primaryKey: true ) var _id: ObjectId = ObjectId.generate()

What do you think?

That should not be the case. Are you sure the list is managed by the Realm already? Could you write out a code sample showing otherwise?

1 Like

I just found the issue.
List was a let constant instead a var.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.