I Can Keep This Short, Right?

Obviously my career as a blogger is not going to happen. That’s OK. I have this site for other reasons.

Since I last posted, a lot has happened. New iPhones. New OS X. New iOS. New Xcode. I’m now on Xcode 7.1 running on OS X El Capitan. I endeavor to do my development in the latest version of Swift when I’m doing Swift (which is what I do for OS X and iOS). Swift 2 has broken some of my code in ways I haven’t figured out.

I am hating the new developer forums. Not all change is good.

My latest efforts have been non-programming related. I’m evaluating programs that are effectively direct competitors to my project. These programs are developed by teams. I am one person. They have also done some pretty cool stuff. I have my work cut out for me if I am to succeed (no guarantees there).

I’m working on a bottom up approach which is not well supported by Xcode. The UI / UX is actually the last bit I’ll be working on if I make it that far. The first part is getting the foundations in place to build upon. This is where changes in Swift have hurt me. Calls to the Core X stuff have broken. I kind of need that to work.

Playing with the programs that do things like what I’m trying to do is educational too. Their APIs are fairly well refined, although I do run into quibbles here and there. They also show me just how much work I have to do.

Stream of ADD

I’ve been distracted again. Not by a project this time. Just by my own inner thoughts. I have this thing that makes it difficult to remain productive for long stretches of time. I worry that it will make me never finish a project of any significance. Mind you, any true work of art is never finished, only abandoned.

Right now, as I type this, I’m not even thinking about what I’m writing. And I’m not a good multitasker. My mind just reals with ideas, thoughts, images, and sounds. These are going on all the time except during rare moments when I feel calmed. This is not one of those moments.

A while back, I was inspired to do a nutrition app for iOS. Something that could be hooked up to Health Kit. The problem that really needs solving is getting a database of packaged foods so that I could scan in the code with the camera and look up that item to calculate such things as calories, sodium, fat, vitamins and minerals, etc. It’s a good app idea. But I haven’t gotten far with it. Getting the database together has been an issue.

Scanning codes led me to the QR Code. I’ve only been peripherally aware of their existence until I wrote two proof of concept apps. Both are on GitHub. One is called HelloUPC. It’s a simple proof of concept for scanning all sorts of bar codes, including QR Codes that are recognized by Core Image. The other is QRTest, another very simple app that lets you type in arbitrary text and produces a QR Code for it.

I’ve played with both apps a surprising amount. Neither are intended as a product. They were just learning exercises.

The idea of using QR Codes for business cards is not a new idea. It is in fact probably a great idea. You can store more than a simple URL in a QR Code. You can store a vCard in there. There is a limit to the data that can be stored. But partial information that allows you to scan a business card that uses a QR Code to encode a vCard is a nifty way to get the information from the business card into your contacts list.

One small problem. I’ve lost all enthusiasm for that project. It’s gone. What happened instead is this crazy idea that it might be possible to store a QR Code as a PNG file in a QR Code for that very same PNG file. I don’t have the math to prove if this can be done or not. Nor do I know how much time it would take if it can be done to find a point of convergence where the data in the PNG file matches the the data in the QR Code. I did find that Core Graphics does not provide a means of writing 1bpp PNG files which would be necessary to get the file size small enough to fit in a QR Code if it can be done at all. So now I’m looking at libpng to do the job.

While libpng is a nice library I’m sure, it is not as simple as using Image IO to write out a graphics file. Or maybe it is. There is a surprising amount of documentation to read to understand how to use libpng. Mind you, I did read a lot of documentation to get as far as I did with writing out QR Codes to a PNG file that is not 1bpp.

So why did I lose interest in the idea of using QR Codes for business cards? I don’t have any business cards. I don’t go out and exchange business cards. I can’t eat my own dog food, an expression that basically means you should be using your own software so that you are a user as well as the author.

I’ve had numerous other app ideas that have gone by the wayside. Usually either due to distractions or the realization that I’m aiming too high for a single developer. Programming is hard. It is amazing how little code you can end up with at the end of the day.

It goes something like this. You have an idea. So you start a test implementation. It’s crap. So you rewrite it. It gets a bit nicer. But you find other ways of doing it that are even better. So you rewrite again. Lines are added and then taken away. It’s like modeling clay except that the clay is spells in a text editor for doing the magic things that computers do. My programming style is very organic in this way. To keep things clean, it is necessary to constantly go back and organize things so that what you grow is a nice tree and not a thorny bush.

Working with these APIs and frameworks has also demonstrated something else to me. Apple has put together a rather nice package of tinker toys. A lot of hard things have been made easy. Mind you, a lot of easy things are still hard. Also, building a complete application from the ground up is not an easy thing to do. There are usually many people who have their hands in the cake, so to speak. You have UI people, UX people, algorithm people, art people, code people, etc. Often there is a lot of overlap.

When you are going it alone, you wear all the hats, including the marketing one.

There’s more. OS X and iOS are not entirely the same. iOS is not simply a subset of OS X. Certainly there is a lot of that. But there are also some fundamental differences. One is based on mouse and keyboard input. The other is based on touch input. Not just touch input either. iOS devices can know where they are and how they are moving. Those are also forms of input. iOS’s different hardware allows for an entirely different style of app than you get on the desktop.

Now here’s the rub. I sporadically come up with ideas that can work on one device type or the other. Now I’ve got one that should work on both. This is where the UI issue comes into play. OS X uses AppKit. iOS uses UIKit. How would one go about writing an app that crosses that boundary in such a way that you have a proper experience on an iPad and on an iMac?

I think that is an interesting challenge. How did Apple do it with Pages? I suspect one has to work at a lower level than both AppKit and UIKit where the common subset of functionality is. And it would be very nice for the file formats to be common to both iPad and iMac (including the laptops of course).

All These Worlds
All These Worlds

Yes, Back To Basics

The problem I’ve been having with the UICollectionView has been solved by vacawama on Stack Overflow. The question I posted, along with the responses I got are here:

http://stackoverflow.com/questions/29715269/uicollectionview-not-sized-or-rotating-properly/29719673

It has been pointed out, correctly, that my manner of asking the question was not ideal (paraphrasing here). I won’t excuse myself. Still, I couldn’t think of any other way to do it. I had no idea where the problem lay. I didn’t think pulling from GitHub would be a huge burden. I was probably wrong on that point even though vacawama took it up.

Now I can go back to the app that really matters and fix the collection view there. I’ve also committed the fix, with credit, to GitHub. So anyone with any interest in a modern way to implement Apple’s CollectionView-Simple example in Swift 1.2 can pull down that project and play with it.

It’s something of a stress relief that the problem was solvable. I just wish I knew how the view options got screwed up.