Last night Neil Danson gave a great presentation on F# on iPad and iPhone in Xamarin Studio at the F#unctional Londoners meetup hosted by Skills Matter. Xamarin announced that they were working towards first-class F# support at their recent Evolve conference, and that support is currently in Beta. Xamarin Studio is an IDE that runs on Mac, Linux and Windows and lets you target iOS and Android.
Easy to follow instructions: Use F# for iOS development
Neil showed how to build a movie database application using the IMDB API that runs on iPad and iPhone in just over 100 lines. It makes use of F# Object Expressions and Async Workflows. The source if available on Bitbucket: https://bitbucket.org/thedo666/imdb
One of the really impressive parts is the readability, the following statement taken from the code composes the application:
start ==> search ==> show_results ==> open_web_page ==> finish
The next demo was a game with the imaginative title “Pissed off owls”, that lets you launch incensed rotund avians at obstacles with physics. Again the source code is just over 100 lines and available on Bitbucket: https://bitbucket.org/thedo666/pissed-off-owls
It is written with MonoGame and uses the Farseer physics engine. Here’s the code to set up the scene:
let player = Actor("Owl",Position(30.f,8.f), Circle, Player, Dynamic)
let level = [ Actor("Background", Position(160.f,120.f), Box, Ignore, None)
Actor("Catapult", Position(70.f,32.f), Box, Ignore, None)
Actor("Mouse", Position(185.f,15.f), Circle, Enemy, Dynamic)
Actor("Mouse", Position(285.f, 15.f), Circle, Enemy, Dynamic)
Actor("Tower", Position(225.f, 64.f), Box, Prop, Dynamic) ]
The video to the talk should be available later today: http://skillsmatter.com/podcast/scala/f-on-ipad-and-iphone-with-xamarin-studio
Another demo showed briefly at the end was PacMan, written in F# and running on iPad. The source code is available on Bitbucket: https://bitbucket.org/thedo666/pacman
It’s a port of some code I wrote for a Coding Kata last year, it also runs on Windows in Silverlight, WPF, Windows 8 and Windows Phone. Play it here: http://trelford.com/blog/post/PacTile.aspx
Want to learn more about MonoTouch F#, I’d recommend Dave Thomas’s short series:
Want to go to an event where YOU write games, Dublin GameCraft is coming to London in August!