I\'m new to swift and realm. I want to make a composite primary key and when I\'m trying something like this :
class DbLocation : Object {
dynamic var id =
Simple create a new property whose value is set to interested other properties which you expect to be compound primary keys.
class DbLocation: Object {
dynamic var id = 0
dynamic var tourId = 0
dynamic var compoundKey: String? = ""
override static func primaryKey() -> String? {
return "compoundKey"
}
}
let location = DbLocation()
location.tourId = 1
location.id = 5
location.compoundKey = "\(id) \(tourId)"