Sunday, November 15, 2015

SudokuBlocks



Recently I've come back to application programming for OS X after a long time away.  I reviewed my notes on Swift from last year (on github here, not updated for Swift 2 yet).  (I was a little dismayed at how little I remembered, but it mostly came back after 8 or 10 hours).

I bought a copy of Hillegass et al. new edition of their great book to write Cocoa applications, which now uses Swift.  I haven't actually done that much with the book yet, though it was a good reference on setting up an Xcode project and hooking up a custom NSView.

For my first project I re-wrote my Color Sudoku program (post about the old one here).  At the top is a screenshot from the new one.  I notice there are similar things out there on the web now, I don't know if they were invented independently or what, but I built my first one in 2006.  In any event, it isn't suitable for mobile because of the tiny squares, so it could probably never be a commercial success.

I've been consistently amazed at how easy programming in Swift has been.  When there was a programming error it was easy to diagnose and fix.  I particularly love the ability to break out function definitions to a new file on a whim (no header files really helps here).  The fact that function names are visible in all the files of a project is a little scary, but it makes this kind of refactoring easy.

I put the new project up on github here, and also put a copy on Dropbox here.  I included a built version of the app in the project folder.  You will have to temporarily "allow apps downloaded from anywhere" or alternatively, install Xcode and build it yourself from the source.

I'm sure there are bugs.  Let me know if you find one.