How do I store a Swift Struct in Core Data on iOS? : <p>At the moment I'm storing one of my classes as NSData in a plist and obviously that isn't a good way to do it.</p>

<p>So I'm trying to set up Core Data, but my class has Structs. This is what I have:</p>

<pre><code>import Foundation
import CoreData

class Favourite: NSManagedObject {
    @NSManaged var origin: Stop

    struct Stop {
        var name: String;
        var id: String;
    }
}
</code></pre>

<p>But this is no good because it says</p>

<p><em>Property cannot be marked as @NSManaged because its type cannot be represented in Objective-C</em></p>

<p>Furthermore, if this error did not occur, I don't know what I'd set it up as in my xcdatamodeld file.</p>

<p>I guess I could store the values in the struct and assign on initialisation of the object? Is this the most optimal/clean way?</p>
