I have the following piece of code
protocol JsonParseDescriptor {
//some required methods
func parsePrimitives() {
}
extension JsonParseDescriptor where Self: NSManagedObject {
func parsePrimitives() {
self.setValue(1, forKey: "id") //this throws an error in swift stating Ambiguous use of setValueForKey
self.setValue(1, forKey: "id") //this does not throw any compile-time error
}
}
Any ideas why setValue:ForKey: is causing this error? Interestingly, setValue:ForKeyPath: isn't causing this issue. I'm just afraid of using the latter incase it causes any side-effects and works other than setValue:ForKey: any ideas?