Example Project?

Are there any example projects to show how to build an Android app using Swift, yet? I'm interested in exploring a cross-platform solution for a pretty simple app, but I'm not sure how to get started for writing for Android using Swift and I'm hoping there's some kind of tutorial somewhere, or at least a sample app I can investigate to understand basic concepts.

3 Likes

I would (of course[1]) recommend starting with Skip, which enables you to create an app in native Swift and SwiftUI for both iOS and Android.


  1. I'm one of the creators of the project. â†Šī¸Ž

5 Likes

Wow, that looks cool. I will check that out for sure. Thanks.

1 Like

Can I develop on Windows with VS code with full autocomplete support?

Windows is actually in a great position for Swift on Android right now thanks to @compnerd . I don't know exactly what the setup steps are, but IIRC it's bundled with the main Swift toolchain (correct me if I'm wrong). Autocomplete should also work, but there's no supported VSCode extension yet. That's something I'm working on right now.

3 Likes

In terms of setup, the installer will allow you to install the Swift SDK for Android. However, the NDK must still be provided by the user (i.e. the user needs to also install the NDK). You need to specify the SDK and target triple when building ATM. The medium term vision is to improve tcrun to get to the point where we can simply do tcrun -sdk Android swiftc -target aarch64-unknown-linux-android ... or tcrun -sdk Android swift build --triple aarch64-unknown-linux-android .... Over time, the goal is to get to the point where VSCode is able to automatically enumerate the SDKs, which will also allow enumeration of supported architectures, and allow you to simply select that from the UI.

1 Like

Not entirely an application, but as a starting point, you could reference GitHub - compnerd/swift-firebase: Swift Interface for Firebase which has an Android build in GHA CI and is a library that was written specifically for Android.

2 Likes

Wow, that's amazing. I'm excited for the VS code extension