Optionality in a NSManagedObject sub-class
Optionality in a NSManagedObject sub-class
- Subject: Optionality in a NSManagedObject sub-class
- From: Daryle Walker <email@hidden>
- Date: Fri, 10 Feb 2017 03:02:59 -0500
It’s simple:
- I’m writing this framework for an app, both macOS, with Swift 3 and Xcode 8.
- My protocol has two non-optional strings.
- I unchecked “Optional” for those attributes when editing the model file.
- I used “Manual/None” for generation, then used the menu command to create the declaration and properties-extension files anyway.
- The class uses “String?”, i.e. optionals, for my attributes.
- This keeps the managed-object sub-class from matching the protocol when I add it from another extension (in a new file).
The properties are mandatory. So is it OK to change the generated versions to non-optionals? What’s the risk/trade-offs if I do so?
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden