(Un)doing the Impossible
Friday, June 16th, 2006Undo is always nice for users, but can be hard for developers. Luckily, this is made easier in Cocoa by NSUndoManager and its prepareWithInvocationTarget method (NSInvocation is great). With this technique, you can just store one method call for the undo reversal. But it’s common to have actions that affect files-and these aren’t as easy to undo. I ran into this in Lexicon for managing LanguageSyncs, which are like dictionary files that are available in many different languages.