-
Notifications
You must be signed in to change notification settings - Fork 251
Add a Getting Started document for the Swift Android SDK #985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Moving this to draft until we have the official release of Swift Android SDK on swift.org |
author: [marcprux] | ||
--- | ||
|
||
Since it was first open-sourced in 2015, Swift has grown from a language focused on creating apps for Darwin based systems (iOS, macOS, etc.) into a cross-platform development language supporting Linux, Windows, and various embedded systems. With the release of the Swift Android SDK, it is now possible to use Swift for Android application development as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Darwin based -> Darwin-based
|
||
### Getting Started | ||
|
||
Building a Swift package for Android involves installing and configuring a cross-compilation SDK. Cross-compilation is the process of building code on one platform (the host) to run on a different platform (the target). In the context of Swift for Android, this typically involves compiling Swift code on a macOS or Linux machine (the host) to produce executables or libraries for Android devices (the target). This differs from compiling Swift for the host platform, where the host and target are the same (e.g., compiling and running Swift code on macOS for macOS). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove parentheses around host and target, add commas instead, as that is important info that you directly reference later. Also, given that the vast majority of Swift use is cross-compilation from macOS to iOS, I don't think such a basic explanation is needed. 😄 Maybe just shorten this to a sentence defining the terms for noobs.
|
||
1. **The Host Toolchain**: this is the `swift` command and related tools that you will use to build and run your Swift code. | ||
2. **The Swift Android SDK**: the set of libraries, headers, and other resources needed to generate and run Swift code for the Android target. | ||
3. **The Android NDK**: the "native development kit" for Android includes the cross-compilation tools like `clang` that are used by the host toolchain to perform compilation and linking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalize initial letters of native development kit.
perform compilation and linking -> cross-compile and link
The global default toolchain has been set to `Swift 6.1.1` (was 6.1.0) | ||
|
||
$ swiftly run swift --version | ||
Apple Swift version 6.1.1 (swift-6.1.1-RELEASE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change these commands to 6.2, as we will not be shipping official 6.1 bundles.
|
||
#### 2. Install the Swift Android SDK | ||
|
||
Next, you can download and install the SDK bundle using the built-in `swift sdk` command: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can download -> download
|
||
```console | ||
$ curl -fSLO https://github.com/skiptools/swift-android-toolchain/releases/download/6.1.1/swift-6.1.1-RELEASE-android-0.1.artifactbundle.tar.gz | ||
$ swiftly run swift sdk install swift-6.1.1-RELEASE-android-0.1.artifactbundle.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switch to single command with checksum instead, ie drop separate curl download?
|
||
#### 3. Install and configure the Android NDK | ||
|
||
The Swift Android SDK depends on the Android Native Development Toolkit (NDK) version 27c to provide the headers and tools necessary for cross-compiling to Android architectures. There are a variety of ways to [install the Android NDK](https://developer.android.com/ndk/guides), but the simplest is to just download and unzip the archive from the [NDK Downloads page](https://developer.android.com/ndk/downloads/#lts-downloads) directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change all references to 27d
Looks good, only wonder if we should add more info on next steps and upcoming work at the end, say linking to swift-java tools. |
Motivation:
This article provides instructions for installing and setting up the Android SDK (swiftlang/swift#80788). It describes the process for the SDK bundle that is created with swiftlang/swift-docker#467.
The structure of the article largely follows the format of the Static Linux Getting Started guide (#686).
Modifications:
Add a documentation/articles/swift-android-getting-started.md article and updates to the articles index and authors list.
Result:
There will now be a new article titled "Getting Started with the Swift Android SDK".