Store CLLocationCoordinate2D in CoreData as Transformable
<p>I want to store a CLLocationCoordinate2D Object in CoreData. I've created an attribute in my entity called <code>location</code> with type <code>Transformable</code>. I've created a subclass of NSManagedObject which looks like this:</p>

<pre><code>extension Task {

    @nonobjc public class func fetchRequest() -&gt; NSFetchRequest&lt;Task&gt; {
        return NSFetchRequest&lt;Task&gt;(entityName: "Task");
    }

    @NSManaged public var name: String?
    @NSManaged public var location: CLLocationCoordinate2D

}
</code></pre>

<p>But when I want to set the attribute it throws an error</p>

<pre><code>let task = Task(context: context)
task.name =  "Hello"
task.location = CLLocationCoordinate2D(latitude: CLLocationDegrees(10), longitude: CLLocationDegrees(12))
</code></pre>

<p>Here the error message:</p>

<pre><code>2016-12-24 11:50:27.425833 CoreDataTodo[839:273413] [error] error: Property 'setLocation:' is a scalar type on class 'Task' that does not match its Entity's property's scalar type.  Dynamically generated accessors do not support implicit type coercion.  Cannot generate a setter method for it.
CoreData: error: Property 'setLocation:' is a scalar type on class 'Task' that does not match its Entity's property's scalar type.  Dynamically generated accessors do not support implicit type coercion.  Cannot generate a setter method for it.
2016-12-24 11:50:27.426143 CoreDataTodo[839:273413] -[Task setLocation:]: unrecognized selector sent to instance 0x1766eca0
2016-12-24 11:50:27.426780 CoreDataTodo[839:273413] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Task setLocation:]: unrecognized selector sent to instance 0x1766eca0'
*** First throw call stack:
(0x1c5a0df7 0x1b803077 0x1c5a6505 0x1c5a4579 0x1c4c93d8 0x4b8cc 0x4bd60 0x21681ee5 0x21681e73 0x2166bf97 0x2168179b 0x216812e7 0x2167bee7 0x2164ccf5 0x21de898d 0x21de25d3 0x1c55c71b 0x1c55c225 0x1c55a4fb 0x1c4a9533 0x1c4a9341 0x1dc80bfd 0x216b7e27 0x216b2551 0x4f520 0x1bc7350b)
libc++abi.dylib: terminating with uncaught exception of type NSException
</code></pre>