Lastest Realm Swift 1.0.1 I do follow this composite primary key realm/swift
It's shows error following
How to i can write with Swift?
You will need to drop the lazy
specifier from the variable declaration as how the error messages states such properties are not supported. You don't want to ignore the property as you want to use it as a primary key.
Beside that I would recommend to separate your integer components within your compound key. (e.g. "\(id)|\(tourId)"
) Otherwise you can end up having different objects with the same conflicting primary key. e.g. You could have objects with compoundKey="123"
for the combination id=1 tourId=23
, but also for id=12 tourId=3
.