What is the preferred way to use clojure for making a mobile app (Android and IOs versions)

StackOverflow https://stackoverflow.com/questions/21313107

  •  01-10-2022
  •  | 
  •  

Question

I've already seen that there are a few tools to build mobile apps from clojure but i would like to know more details about libraries, environment, drawbacks, profiling and real working examples

Thanks

Was it helpful?

Solution

Using ClojureScript with React Native is now becoming a great answer to this question:

  • Performance of React Native is great.
  • Existing React libraries like Om and Reagent work with React Native.
  • You can benefit from “learn once, write anywhere” knowledge reuse.
  • You benefit from using a stack and language that have significant communities behind them.

And the most compelling reason: React Native allows you to write mobile apps using ClojureScript's strength as a functional language, avoiding the imperative style, mutation, and statefulness.

OTHER TIPS

So far, here is my investigation result:

To create native mobile apps I've found 2 lein plugins available:

  • Native android: lein-droid. Let's you compile, deploy, install and live repl with usual lein commands [lein droid doall, lein droid install, lein droid compile].
  • Native iOS: lein-fruit. A Leiningen plugin for building native iOS apps in Clojure and Java using the RoboVM bytecode-to-native translator.

There is also another interesting way to build an iOS app in the same way that works clojurescript to obtain javascript. In this case from clojure to scheme to C with clojure-scheme

And on irc #clojure channel, David Nolen and others suggest the following paths:

[6:27pm] dnolen: tangrammer: w/ iOS you'll have better luck with the JavaScriptCore bridge and ClojureScript  
[6:27pm] dnolen: tangrammer: I've tried it works great and I know other people are experimenting with it as well  
[6:28pm] dnolen: tangrammer: it does limit you to iOS 7, but you could take the Ejecta approach for earlier OSs
[6:38pm] dnolen: tangrammer: core.async on iOS works great
[6:38pm] dnolen: tangrammer: you can also do multithreaded CLJS on iOS

The Why and How of Clojure on Android is a great starting point and covers this better than I could here. From what I have seen the lein-droid leiningen plugin is the easiest way to get started though the process is sometimes not entirely smooth.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top