• 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
Re: "Library" smart group in Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Library" smart group in Core Data


  • Subject: Re: "Library" smart group in Core Data
  • From: Jonathon Mah <email@hidden>
  • Date: Mon, 30 Jan 2006 00:08:34 +1030

Hi Ben,

On 2006-01-28, at 09:22, Ben Kazez wrote:

I'm developing a Core Data application with an interface similar to iTunes, iPhoto, and other applications, in which a Source table lists a group called "Library" that contains all the items the application manages.

I am currently doing the same. The solution I used was to make a LibraryAlbum subentity of Album, overriding the -photos accessor to return all the objects with entity Photo. You also need to observe the managed object context and update yourself as the photos change. (See Core Recipes for how to do this.)


When the document first gets created, I create a single LibraryAlbum, and store a reference to it in my NSPersistentDocument subclass (similar to Core Recipes). When I load a document, I fetch all LibraryAlbum objects (there should only be one) and hang onto the first one.

This code shows how to make an object on document creation:
<http://developer.apple.com/documentation/Cocoa/Conceptual/ NSPersistentDocumentTutorial/04_Department/chapter_5_section_2.html>


I also looked into using an in-memory store, but it seemed unnecessary. I vaguely remember Core Recipes using it for importing from multiple documents, which my app doesn't do. If you do use multiple stores, you have to specify a store on creation of every object. And there's no harm in storing a tiny Library object in your document file. :)

For my source table view, I used a "priority" key like Core Recipes to keep the Library group at the top.


Hope this helps,


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
References: 
 >"Library" smart group in Core Data (From: Ben Kazez <email@hidden>)

  • Prev by Date: Re: Using Evan Schoemberg's Custom tabs
  • Next by Date: -[NSAttributedString initWithPasteboard:...] vs. Dictionary
  • Previous by thread: Re: "Library" smart group in Core Data
  • Next by thread: Java Cocoa application, Java VM not launching
  • Index(es):
    • Date
    • Thread