Introducing Napkin

So here’s what I’ve got. Imagine a text editor that also has the capabilities of a spreadsheet. At its most basic level, you could type a mathematical expression, hit the equal sign and get an answer. Further, you could write out items in column format using nothing more than the tab key. The app would know to keep columns lined up, and it could perform math both across rows and down columns.The notion here is that I want a tool that would let me put together ideas and lists very quickly, without having to open a spreadsheet. For what I use a spreadsheet for, opening Excel or Numbers feels like total overkill. My documents could have some free-form text, maybe a few calculations, and a table of figures where I add up a few items. But it would be awesome if I could try different numbers in order to see how it affects the results.

It’s the equivalent of a cocktail napkin, where I might otherwise scribble out an idea, or keep track of things. Hence the name of this app!

I did a sketch of what I thought the app should look like:

I don’t know if this app will be hugely successful, but I do think it would be something I could use. And I’m pretty sure there’s nothing else quite like it on the market. So let’s go for it. This blog will be detailing my efforts at implementing the Napkin application at a very low level: I’ll be breaking the app down into every little piece of functionality and writing something about how I chose to implement it. This is as much for my benefit as anyone else — and maybe more for me.

Right off the top, I had a very hard time choosing what kind of view to implement Napkin in: an NSTextView or NSTableView? The latter view would theoretically give me more spreadsheet-like capabilities out of the box, allowing me to readily parse the contents of cells going up and across columns. On the other hand, the text part of the application would probably be difficult to implement, as it would also be in a cell that would push out columns as well. The benefit of a plain text document is that tab stops can be used anywhere in the document, or not at all. Ultimately, it was that flexibility that led me to choose NSTextView as the starting point for Napkin.

Of course, that’s going to leave me with some problems parsing data down the line. Well, I’m sure we’ll talk about that when I get to it.

Next: Implementing Calculations