Any way to use some Scala for iOS coding?

2020-02-26 04:15发布

问题:

I want to be able to use Scala to code iOS programs. Any tools available for this ?

回答1:

You can run JavaScript on iOS, so you could compile your Scala to JavaScript using Scala.js. This has obvious huge limitations - I wouldn't want to try to code actual native iOS UI - but might be practical for some cross-platform logic. Combining this with React Native might be interesting.

There's also Scala Native as of a couple months ago; that should probably run on iOS. It's not ready for production use, but keep an eye on it.



回答2:

Well, now you can use RoboVM - a Java library for native IOS development

See also:

  • an SBT plugin for RoboVM https://github.com/roboscala/sbt-robovm
  • A blog post aboute Scala development for IOS http://ajhager.com/


回答3:

Not today, but it may be close:

  • http://java.dzone.com/articles/oracle-gets-java-running-ios
  • http://www.oracle.com/technetwork/developer-tools/adf/overview/adf-mobile-096323.html

But, while Apple directly opposes the use of the JVM on iOS devices, it will make little sense to go that way (it's still early days). You will run into one obstacle after another, and won't have any guarantee that the code you write today, will run on the iOS of tomorrow.

Sit on the sideline with your Android, Ubuntu and popcorn, and let the big guys fight it out.

In the meantime.... you can write a thin front-end in PhoneGap (which works on most modern mobile devices), your services with Spray and have fun with your back-end in Scala.



回答4:

I recently developed a toolchain based on IKVM and MonoTouch that allows you to develop iOS apps in Scala. I put together a demo of the toolchain here:

https://github.com/samskivert/ios-scala-demo



回答5:

Currently Codename One doesn't have builtin support for Scala but it supports Kotlin reasonably well. There is a blog post here that covers the process of adapting Codename One to support other JVM languages. By doing that you can instantly get support for other platforms such as iOS, UWP, JavaScript/Web, Android & desktop mac/windows for free.

The core of Codename One which includes the VM's, API's and most of the tools is open source.



标签: ios scala