Core Data Drag and Drop With Groups


In this example you are able to use drag and drop to change the order of items in a single tableview, and to change group membership of nested items in objects with relationships, all with Core Data. The behavior is like iTunes style Playlist / Song relationships.

A few other bonuses:

  • an “instant edit” for the groups table that places the users cursor in editing mode inside the newly inserted row when the user clicks add.
  • delete key removes rows. (care of rentzsch.com)

This code was put together from the Apple DND examples as well as many of the examples out there on the web. I have only tested it on 10.5, but I did set the Target to build for 10.4 so in theory it should work. This code is free to use with no guarantees of any kind.

© 2011 Adam Gerson.