rentzsch/mogenerator — pull request #245 by brentdax (2014-09-02 08:32:07+00:00)
Title: Better optional property behavior and other enhancements to Swift support

This pull request includes several enhancements to Swift support.

The main thing it does is give `mogenerator` a more sophisticated and nuanced understanding of Swift optionals. Commit 4a11e53's log message explains the rationale, but in short:

* Optional properties are treated as Swift optionals (?).
* Certain non-optional properties that can be nil before the object is first saved are treated as implicitly unwrapped optionals (!).
* Non-optional properties that can't be nil unless you're doing weird, seemingly useless things are non-optional.

This also includes two other small changes, which I apologize for including in an otherwise very focused branch:

* The human file templates now include an "import CoreData" statement (cb09202). This is not strictly *required* for a managed object subclass in Swift, but it's necessary for many extremely common operations, such as creating fetch requests or taking managed object contexts as parameters, so it seems more convenient to include it.
* Machine templates also include the `Set` properties from the Objective-C templates, which access mutable proxies for relationships (48b1b9b and a39cddf). I've always found these incredibly handy.

If you don't like one of these, I won't be offended if you cherry-pick it out. Their commits don't include changes affecting the optional stuff.