• 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
Strategy for read only Templates with Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strategy for read only Templates with Core Data


  • Subject: Strategy for read only Templates with Core Data
  • From: George Orthwein <email@hidden>
  • Date: Fri, 2 Jun 2006 12:04:20 -0400

My app allows the user to adjust a bunch of settings and save them as Templates. These templates are represented by an Entity. I want to provide a bunch of read-only default templates and I have successfully used addPersistentStoreWithType: to add a read only store from the application bundle to the moc. It works fine, except they are still editable, causing an error on save if edited (I guess read-only doesn't prevent editing).

Anyway, what I'd like is that when any changes are made to a default template, a copy is made and changes are made to the copy instead.

I'm not sure how I should intercept changes though. The controls are bound to the currently selected template and thus change the attributes directly. I looked briefly into validation but that doesn't seem like the right thing. I could disable the controls when a default template is selected and force the user to make a copy first, but that isn't a very nice user experience.

I suppose I could write custom accessors for every attribute and check to see if it is a default template and if so, create a copy, but that seems like quite a bit of work. Maybe I could observe the template for changes and if it changes, make a copy, and somehow revert the change?

Another idea is to make a copy of the default template when it is selected and hide the original through filtering. And then if it is edited I can rename the copy and reveal the original again. This seems quite inelegant as well. :)

Any ideas on how to approach this are very much appreciated!

Thanks everybody,
George
_______________________________________________
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: Strategy for read only Templates with Core Data
      • From: George Orthwein <email@hidden>
  • Prev by Date: Re: why doesn't my scrollview scroll ...
  • Next by Date: Do ArrayControllers have access to all data?
  • Previous by thread: Re: 2nd fullscreen window and keyboard input
  • Next by thread: Re: Strategy for read only Templates with Core Data
  • Index(es):
    • Date
    • Thread