Last active
December 31, 2017 01:56
-
-
Save kmkrn/356962f175383e0095de3b40aec49c4f to your computer and use it in GitHub Desktop.
LinkingObjects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cats = realm.objects(Cat.self).filter("name = 'Tigger'") | |
for cat in cats { | |
realm.beginWrite() | |
cat.owner = cat.person.first | |
try! realm.commitWrite() | |
if let owner = cat.owner { | |
print("\(owner.firstName) \(owner.lastName)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment