I have an iOS app that was created before the acquisition of Realm by Mongo. I am in the process of updating the code to work with Realm Synch.
Reading through the documentation it states that I should add the following to the class declarations I wish to synch:
// Some of the sample code videos uses this as well, which appears to be the same as above.
// I am assuming both accomplish the same.
// @objc dynamic var _id: ObjectId = ObjectId.generate()
@objc dynamic var _id = NSUUID().uuidString
override static func primaryKey() -> String? {
return "_id"
}
All of the class declarations I have already use:
@objc dynamic var uuid = NSUUID().uuidString
override static func primaryKey() -> String? {
return "uuid"
}
Here is an example
Many of my classes look like this:
final class UserInfo: Object {
@objc dynamic var someVar = ""
@objc dynamic var anotherVar = ""
@objc dynamic var uuid = NSUUID().uuidString
override static func primaryKey() -> String? {
return "uuid"
}
}
Can I use what I already have using the var uuid
instead of var _id
. I have about 40 classes and need to convert and would prefer not to do that, if possible.
Thx in advance.