Skip to content

michiamling/swift-android-samples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Samples for the SwiftAndroid toolchain.

Requires a build of the latest Android toolchain downloadable here, an Android NDK as well as [the Gradle plugin] (https://github.com/SwiftJava/swift-android-gradle) on a Ubuntu 15 System. The phone must be api 21 aka Android v5+ aka Lollipop or better (I used an LG K4.) Make sure the version of swiftc in the toolchain appears first in your path and there is a swift-build from a swift.org toolchain in the path and finally, that the ANDROID_NDK_HOME environment variable is set to the path to the NDK.

To create a new application, decide on a pair of interfaces to connect to and from your Swift code and place them in a Java Source. Use the command ./genswift.sh in the SwiftJava Project to generate Swift (& Java) sources to include in your application or adapt the genhello.sh script. If you only use interfaces/protocols, your app's only Package.swift dependency should be the core JNI interfacing code java_swift.

Simple demo of Swift code accessed over JNI.

To build, setup the Gradle plugin, then run ./gradlew installDebug

This demo is licensed under the Creative Commons CC0 license: do whatever you want.

About

Samples for the SwiftAndroid toolchain.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 87.2%
  • Java 12.8%