I am using Realm for Swift 1.2, and I am wondering how to implement a composite primary key for an object.
So you specify your primary key, overriding primaryKey()
override static func primaryKey() -> String? {
The only way I can see is to create another compound attribute like
var key1 = "unique thing" var key2 = 123012 lazy var key: String? = { return "\(self.key1)\(self.key2)" }() override static func primaryKey() -> String? { return "key" }
How do you correctly supply composite keys in Realm?
ios swift entity realm
styler1972
source share