[swift-users] Build Android GUI apps with Swift 3.0 via a framework/library

Tony Constantinides constantinnovationsinc at gmail.com
Tue Oct 18 12:23:28 CDT 2016

So according to the Swift Community I should adapt Kotlin and not Swift as
my choice for the programming language for a  cross-platform GUI framework?
Is that really going to be easier than building a GUI framework for Android
as listed on this page?

The main technical issues I can think of when building Android Java API
Access is the following:
a) You can only call static Java methods from the NDK Main Thread in Android
b) If I go the Android NDK(C/C++) approach, it provides access to the C++
API of Android but not the Java API of Android. It bootstraps differently
in that you have access to a NativeActivity class but a lot of Java Android
is deriving from an Activity and adding your overrides. I wonder if that
possible doing that with JNI
c) You would not have access to the XML way of declaring an Android GUI but
will have to do everything in code (I have experience in this in Android).
This is not a problem just extra work
d) Since the Java API of Android bootstraps differently you would need to
add libraries to your module maps in Swift so you can bootstrap the Java VM
literally in Android so you have access to the Java Environment via Java
Native Interface.

Anyone else think of how to call Java API from Swift? I was thinking  a
bootstrap Java Android skeleton app, which receives an API via a 64 bit
encoded number. The number is converted into a string and passed into a
switch statement where the correct API call is made.
Any fresh ideas?
Sincerely yours,
Tony Constantinides

On Mon, Oct 17, 2016 at 9:34 AM, Jens Alfke <jens at mooseyard.com> wrote:

> On Oct 16, 2016, at 1:35 PM, Tony Constantinides via swift-users <
> swift-users at swift.org> wrote:
> Kotlin does not run on iOS without some custom VM (Robot VM) which would
> kill performance.
> If you mean RoboVM, it claims to use ahead-of-time compilation of Java to
> native code, so there shouldn’t be much of a performance penalty.
> (Definitely a *size* penalty, though!) However, RoboVM appears to have
> been discontinued.
> —Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161018/d0af0fb6/attachment.html>

More information about the swift-users mailing list