Cleaning Up. Plus: What You Get For Free!

Okay, things are moving again. Having got my application to save and open documents, I decided that I would clean that up a bit, by filling in some configuration in XCode. Going to my Target and showing the properties, I was able to change the name of my documents from ???? to .nap, and provide nice document icons.

I also named my document format: “Napkin Doc”, and so that’s what you see when you Get Info… on the saved documents. I then added a shitty icon I created for another project. Want a look?

You double-click that file, and Napkin opens it! This is so cool!

Getting it for free My next two tasks actually did themselves. I wanted to add Cut-n-Paste as well as drag-n-drop to Napkin. But because I was using the built-in Cocoa document architecture, the behaviour was already there!

I can copy text from another app and paste it in. I can also drag and drop text both into and out of the application. Check!

The second thing I wanted to add was undo. I was comparing what I knew about undo in Hillegass to what I wanted to accomplish, and it sounded like it would be another Wall on my hands. However, a quick search in Google revealed the answer: Interface Builder!

In IB, choose the NSTextView instance, go to the Properties panel and choose “Undo”. Done!

Wow, I barely broke a sweat on those ones.

Next Steps So next on my agenda? Printing. That’ll be easy too, right? We’ll see.