I need some help with my Swift rookie programming...
In a many-to-many relationship, I have a NSManagedObjectID that I`ve segued from another view controller.
To retrive data from it I have used this:
var elevid :NSManagedObjectID?
let person = context.object(with: studentId!)
nameTextField.text = person.value(forKey: "name") as? String
This works fine, but when I try to get an attribute from a relationship I`m stuck.
I´ve tried this:
let isAtSchool = person.value(forKeyPath: "isAtSchool.monday") as! Bool
but I get an error telling me:
Could not cast value of type '__NSSingleObjectSetI' (0x10ac63aa8) to 'NSNumber' (0x109e5a4a8).
If I use ? after as instead of ! it returns nil.
Someone know how to do this?