• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Optionality in a NSManagedObject sub-class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Optionality in a NSManagedObject sub-class
      • From: Daryle Walker <email@hidden>
  • Prev by Date: Re: AVSimplePlayer in Swift?
  • Next by Date: Intercept Save when closing NSDocument
  • Previous by thread: Re: AVSimplePlayer in Swift?
  • Next by thread: Re: Optionality in a NSManagedObject sub-class
  • Index(es):
    • Date
    • Thread