Open PGLongo opened 9 years ago
I think that we could change NSManagedObject extension using generics.
For example:
Now
func createNewEntity(context:) -> NSManagedObject {} ... let pokemon = Pokemon.createNewEntity() as! Pokemon
After
class func createNewEntity <T> (context:) -> T {} ... let pokemon : Pokemon = Pokemon.createNewEntity()
In my opinion is more secure because you receive a compile error if the type is not explicit!
but still requires a type annotation right?
whats the interop with Obj-C like? id ?
Obj-c with Xcode 7 has Generics, but I have never tried
I think that we could change NSManagedObject extension using generics.
For example:
Now
After
In my opinion is more secure because you receive a compile error if the type is not explicit!