A Leiningen plugin for building native iOS apps in Clojure and Java using the RoboVM bytecode-to-native translator. It is modeled after lein-droid and the commands are similar. Both plugins are included in Nightcode, for those who prefer not using the command line.
- There is no REPL and any attempt to call eval at runtime will cause an exception because iOS doesn't allow executable memory.
- Due to Clojure's import behavior, importing most RoboVM Cocoa Touch classes will lead to a compile error. Instead, you must invoke these classes dynamically. The template provides an example of this, including some helpful convenience functions.
- Get a computer running Mac OS X
- Install Xcode
- Install JDK 7
- Download and extract robovm-0.0.8.tar.gz
- Install Leiningen, and create or modify
~/.lein/profiles.clj
so it looks like this:
{:user {
:plugins [[lein-fruit "x.x.x"]]
:ios {:robovm-path "/absolute/path/to/robovm-0.0.8"}
}}
Replace the "x.x.x" with the version below:
# Create a new Clojure/iOS project
lein fruit new hello-world
# ...or a new Java/iOS project
lein fruit new-java hello-world
# You may optionally specify a package name
lein fruit new-java hello-world info.oakleaf.hello_world
# Build an x86 version and run in a simulator
lein fruit doall
# ...which is the same thing as
lein fruit compile && lein fruit run
# Use the iPad simulator
lein fruit doall -ios-sim-family ipad
# Build an ARM version and run on a device
lein fruit release
# ..which is the same thing as
lein fruit compile && lein fruit ipa
# Show RoboVM flags (all flags are passed to it)
lein fruit help
All files that originate from this project are dedicated to the public domain. I would love pull requests, and will assume that they are also dedicated to the public domain.