Posts tagged ‘Code’

Mac Dev (Europe) 2009 – European Conference for Mac Developers

You may have noticed a bit of a lull between my last few posts to this site; I apologise in advance for the shameless plug but this is because I have been working with Steve Scott (aka Scotty) of the Mac Developer Network and Late Night Cocoa etc podcasts to bring you a Macintosh Developer Conference taking place here in Europe next April 2009.

Continue reading ‘Mac Dev (Europe) 2009 – European Conference for Mac Developers’ »

  • Share/Bookmark

A Bindable Custom NSView Subclass

In this post I’ll walk through writing a custom subclass of NSView that can bind to an NSArrayController to display information either from some generic array connected to the array controller, or from a Core Data object model.

The view we’ll be creating is a custom view to display a pie-chart; in the sample app the pie-chart will be drawn from data entered in an NSTableView. The finished application looks like the following:
The finished sample application showing the custom NSView subclass bound to a Core Data entity
Continue reading ‘A Bindable Custom NSView Subclass’ »

  • Share/Bookmark

On Cocoa Bindings – “Let Us Break Their Bonds Asunder”

Chances are, if you’ve developed any kind of Cocoa application, you’ve probably made use of Cocoa Bindings in one way or another, particularly when it comes to Core Data. The technology is ‘key’ to so many of the underlying frameworks but it is a technology that tends to be often-used but frequently not fully understood.

If you are someone who happily binds Array Controllers and View objects together using Interface Builder but have always wondered discretely exactly how the magic behind the scenes happens, or if you just don’t quite comprehend the difference between ‘KVC’ and ‘KVO’ (or perhaps can never quite remember what they stand for…), this article might help you out. In it, I’ll attempt to demonstrate a ‘faux-bindings’ methodology that connects a value from one object with a value from another object, but without using the actual Apple Cocoa Bindings technology. The bare-bones of how the ‘faux binding’ works will be there for all to see; while the internal workings of Cocoa Bindings are a little different, this will hopefully at least show you what, how and why certain things are required for the real Cocoa Bindings to work successfully.

Continue reading ‘On Cocoa Bindings – “Let Us Break Their Bonds Asunder”’ »

  • Share/Bookmark

Core Data Migration and Versioning

By default, a Core Data application will refuse to load data created using an older data model. So, if you’ve been using one version of your model for ages and have loads of data, it’s a bit of a pain that should you wish to add an entity, attribute or relationship or make other changes to your model, you won’t be able to open the old data in a new version of your application.

Prior to OS X 10.5 if you wanted to convert data from one model version to another, you had to handle the conversion code entirely yourself. With Leopard, however, Apple built in versioning and migration capabilities to make dealing with data migration a great deal easier.

This article looks at how you can support data migration in your Core Data applications. It shows how to handle changes entirely using Data Model versions and Mapping Models, before looking at customizing the process by using custom migration classes.
Continue reading ‘Core Data Migration and Versioning’ »

  • Share/Bookmark

Core Data and Sync Services

Apple’s Sync Services framework allows applications and devices to keep in sync with each other’s data. If you subscribe to the MobileMe service, for example, it is Sync Services that handles synchronization between the server, your computers and any connected devices such as an iPhone. This article discusses adding synchronization capabilities to Core Data applications. We’ll start by looking at the information you must provide to allow synchronization to take place and then build two sample applications that will keep in sync with each other.

Continue reading ‘Core Data and Sync Services’ »

  • Share/Bookmark

Sample project code now available for all posts

It is now possible to download example finished projects for each of the walk-thru articles so far:

Continue reading ‘Sample project code now available for all posts’ »

  • Share/Bookmark