Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use NSArrayController bound to NSUserDefaultsController with custom class

I have a NSArrayController bound to NSUserDefaultsController, and the array stores a custom class of mine, which conforms to NSCoding.

It seems like I need NSArchiver, but I can't quite figure out how to glue it all together

like image 698
aussiegeek Avatar asked Jun 11 '26 03:06

aussiegeek


1 Answers

You need a value transformer, which you can specify in the options of the binding. You can use NSKeyedUnarchiveFromData to serialize the array to keyed archive data, or make your own custom value transformer to convert the objects in the array to property lists of your own design.

like image 62
Peter Hosey Avatar answered Jun 15 '26 02:06

Peter Hosey