Can we create Mobile apps in elm?

Im about to start a startup , so we want to build mobile apps that’s our targeted audience .
So heres the thing i dont like JS and especially react.js and flutter is some bunch of widgets . So im wondering can we make our front end of our mobile apps in elm i dont know much about front end .
any advice would be greatful.

1 Like

We have done an Elm website and wrap it in a WebView within mobile app.
We use native code in Swift/Java to link up the WebView (vs ports) and mobile.

If your mobile app does not rely heavily on native functionalities such as GPS, bluetooth, etc AND don’t have heavy animation,
this setup is good enough to work with.

Otherwise, a typescript-React Native approach is the next best thing we have…
It’s not even close to the joy of coding in Elm
but it is the next best thing… :upside_down_face:

2 Likes

IMHO, go for flutter. I have done native development for both android and ios, react native and qt.

  • Native development makes you do all the work twice
  • In react native you suffer from not having a clear and common way of doing things and depending on the community for almost everything. It follows the javascript ecosystem norm: many projects doing the same thing with slight improvements instead of one big good thing.
  • Qt is almost impossible to compile to mobile and has a very tiny community, though QML is a really great idea.

Flutter does the things they way they need to be done:

  • Compiles to native binaries like Qt.
  • Has a shared repository for packages from the community like typescriptwith npmjs.
  • Has officially supported UI for both android and ios like native development.
  • It is supported by a big company, Google, the same as react, Facebook.

But also, it adds:

  • You code with Dart, kind of like javascript, but with some improvements to make writing code easier (less error prone).
  • It offers clearly differented UI libraries for ios and android. When you start coding a mobile app, it is common to try to have the same UI codebase for both ios and android, but at some point it becomes unmaintainable and then you have to split the two UIs codebases. Flutter takes you to the right direction from the beginning.
  • It uses declarative UI, so it feels familiar if you come from Elm.

More or less this is my experience.

5 Likes

You can get pretty far with progressive-web-apps, but you’ll have some “wiring” written in javascript. Also, if you have major features that rely on stuff Elm can’t do on it’s own, it might get hairy if you don’t like JavaScript/TypeScript.

My approach has been:

  1. build the Elm-project, where only the little bit of JavaScript required to initialize the app and setup ports is written
  2. Build typescript-modules for specific features, ensure they have nice autocomplete in VS-Code, and deploy them to NPM for import into the main project.

The core team is being really ambitious about what Elms APIs should look like, and for that reason, they’re taking their sweet time getting support for a lot of stuff. Ports are nice once you get the hang of it :sunny:

thanks then flutter is the thing i’m looking for.

Maybe try to look at Revery for ReasonML. It feels a bit like Elm.

2 Likes

Also, there is ionic Framework !

While I haven’t tried it myself, F#'s Elmish ecosystem looks like an option worth considering. You get to use the Elm architecture you know and love, while targeting the browser (Fable Elmish) and mobile (Fabulous). It also helps that the F# language itself is similar to Elm in many ways (similar syntax, functional-first style, pipe operators, the lack of more ‘heavyweight’ features like typeclasses, etc)

1 Like

I read on reddit someone complaining that F# compiler is way too slow. I would double check that if I would you go for this, which looks very interesting too.

I’ve been writing Progressive Web Apps in Elm for a while. I intend to put this one into app stores next using https://capacitorjs.com/

5 Likes

I also use elm wrapped in a pure webview application. Persistant storage, camera, even bluetooth sometimes ++ is avaiable in the browser. But if I need some special stuff only avalable native (rare) I wire up ports directly to native (java or swift) … I can not go back to anything else after getting used to elm-ui :smiley:

4 Likes
1 Like

If you really want to use Elm, you might be able to combine it with NativeScript to make a mobile app - though I don’t know how easy or advantageous it might be :man_shrugging:

That looks interesting. I notice that the markup it uses is not HTML - but I guess you can generate whatever markup you like with elm/virtual-dom? Perhaps even write a package of functions for building native script markup on top of that?

Also, presumably you would use Browser.application etc to write an Elm program. Would all the Browser.* packages work as they do in a browser?

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.