Gamut Redivivus: OCaml App in iOS Simulator
I recently revitalized an OCaml app from a few years ago, one that runs in the iOS simulator. Instructions for downloading, building, and running the app are here:
You can download the sources directly here:
Although the app doesn’t do anything particularly impressive, I still find it mesmerizing and fun. But mostly it just shows how to get an OCaml app running in the iOS Simulator.
Here are some insights I had while revitalizing the app:
When calling OCaml from the Objective C world, don’t pass expressions as parameters if they cause allocation in OCaml. I wrote about this in Further OCaml GC Disharmony.
The geometry of an iOS app needs to be a lot more fluid than it used to be. Statically, there are many different device sizes. But also the shape of the screen changes dynamically at times. Believe it or not, I recoded Gamut so the display continues to look good when you receive a simulated incoming call. (A small change in such a simple app.)
It would be frightening to receive a simulated incoming call and find that it was a simulated version of your mother calling from your childhood to say that dinner is ready.
You can re-use the drawing code of your app to draw an icon with a more squarish shape.
Now, reader, I have to rush off to my desk in an arcane underground DNA lab to learn about general-purpose GPU-based processing. It would be a blast to see it work in an iOS app someday. If you have any trouble (or success) getting Gamut to work for you, leave a comment below or email me at jeffsco@psellos.com.
Posted by: Jeffrey