Filtering With Core Data

08/02/2005 20:16:02

ComputerStuff

I began experimenting with Core Data when I got Tiger a month or so ago. It made rapidly developing certain kinds of data centric applications quite easy. But I soon discovered that some common ways of interacting with your data were not available.

There was no easy way to simply create something like “playlist” and simply drag and drop between them to establish a relationship. Drag and drop in general didn’t work.

So I developed a simple framework designed to implement some of these common, reusable behaviors. It was also an experiment to begin (re)teaching myself Cocoa/Objective-C, etc.

Download

  • Filtering Example 1.2.zip (http://fletcher.freeshell.org/downloads/Filtering_Example_1.2.zip)

Screenshot

[[image:FilteringExampleScreenshot.png]]

Description

This demo consists of objects representing people (firstName, lastName, nickName). The left column is designed for collections and filters. Collections are “manual playlists” - you drag and drop to establish a connection between a person and a collection. Filters are “smart playlists” - for now you create them by writing a filter predicate in the text box in the lower left. In a finished app, you could use a GUI to do this. Folders are used to organize collections and filters. By dragging and dropping within the outline view, you can rearrange collections and filters to quickly change your search.

You can use the searchbox in the upper right as usual.

The two single column tables are designed for interactively browsing your data. By clicking on one or more first names, you restrict the data to those objects that match. Then you can do the same thing with a last name. This allows you to quickly drill down to find the data you want.

The source code is available above. Please take a look, and give me feedback. I make no promises that this is the best way to do things, it simply works for me. Also, I am NOT an expert with Objective-C. I am sure there are some problems with the code that might crop up after heavy use (memory leaks?). Please feel free to suggest improvements from that perspective.

There is a Readme within the download with more information

As always, feel free to edit this page to make it more clear, or to leave comments…

This project is released under the GPL

Release Notes

  • 1.2 - now you can interactively search on interests, both within searchbox and in a browser table

  • 1.1 - added the ability to store ordered arrays of information within Core Data, an array controller subclass that allows drag and drop reordering, a complexsearchcontroller that allows you to use the searchbox to search for words, rather than a phrase.

  • 1.0 - initial release

Similar Pages