Skip to content

Use Generics in NSManagedObject Extension #45

@PGLongo

Description

@PGLongo

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!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions