The Ultimate Business Machine - Archives
List of Categories : Commentary * Database * Singapore * Technology * Travel *
Sat 26 Feb 2005
Category : Technology/UserDefaultsBindings.txt
I was playing around with that part of Cocoa Bindings that allows you to save the user's preferences without writing any code.
The window above shows a slider, colour well, popup menu, switch, radio buttons, and a text field - covering, more or less, all the things you're likely to use in a preferences panel.
The User Defaults Controller mechanism, which first appeared in Panther, worked very well, saving the state of your preferences when you quit the application and restoring everything when you came back.
It was all so easy to set up.
The "Helvetica" text on top of the window also shows the power of Cocoa Bindings to synchronise the appearance of an object dynamically with the state of your preferences - e.g., its size, font, colour, and even its contents.
No code. Yet, you get neat entry points into the system to exert control, if and when you need to. For example, I could save the location of the circle, which doesn't have a user interface control, together with the rest of the preferences, so that it reappears at the exact same position when I quit and come back into the system.
Amazing stuff, because it's neat and easy to understand.
It just encourages you to build things. In over twenty years, this must be the best software development environment I've ever had the pleasure of using.