• 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
Read-Only Core Data Attributes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Read-Only Core Data Attributes


  • Subject: Read-Only Core Data Attributes
  • From: Jonathon Mah <email@hidden>
  • Date: Thu, 4 May 2006 17:34:58 +0930

I'm making a wiki-like application with Core Data. (It will be open- sourced when it's more ready.) The application stores past revisions of entries. Each revision has an 'isProvisional' attribute; this is YES on creation, and stays YES until -commitRevision is called.

The attributes of each revision can only be changed while isProvisional is YES; this prevents changing past revisions. My question is, how should I enforce that attributes of non-provisional revisions be read-only?

My ideas:
1. Implement validation methods that return NO (unless the new value is equal to the current one).
2. Throw an exception in setter methods if the revision is read-only.
3. "Accept" setter messages, but simply ignore them (keep the attributes unchanged).


Which is the best way to enforce read-only attributes? I'm leaning toward using both 1 and 2 above.


Thanks,


Jonathon Mah email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Read-Only Core Data Attributes
      • From: Kay Roepke <email@hidden>
    • Re: Read-Only Core Data Attributes
      • From: Kay Roepke <email@hidden>
  • Prev by Date: CoreData, NSArrayController
  • Next by Date: [Newbie] Webkit Tutorial or how to load HTML-Source filled NSData into WebKit
  • Previous by thread: Re: CoreData, NSArrayController
  • Next by thread: Re: Read-Only Core Data Attributes
  • Index(es):
    • Date
    • Thread