SuperRecord
SuperRecord copied to clipboard
Use Generics in NSManagedObject Extension
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