The Android API for Swift is the SPM package allowing to access Android SDK from the Swift programming language. The API maps main Java constructs such as interfaces, abstract classes and generics in order to make porting Java programs using Android SDK as simple as possible.
Currently the project is in active development, over the time more packages as well as API levels will be added. Every API level is located in a separate branch. Please, create a GitHub issue for requesting new packages so that we can add them as fast as possible.
In order to use the API from Swift the best is to use SCADE IDE. You can also consider to use the cross-platform framework Fusion consisting of several SPM packages. The Android implementation of Fusion is based on this project.
For using this package directly one should add an SPM dependency to a Package.swift file and add required target dependencies of Android SDK packages to the product. An example can be found at FusionLocation/Package.swift The SPM target names are mapped as following:
SDK package name | SPM target name |
---|---|
android | Android |
andorid.app | AndroidApp |
android.content | AndroidContent |
android.media | AndroidMedia |
android.bluetooth | AndroidBluetooth |
Please see LICENSE for more information.