How it works
The explanation, with examples you can run.
Servers
Server-side Swift is the most mature use outside Apple. SwiftNIO is the event-driven networking core (like Netty for the JVM); Vapor and Hummingbird are web frameworks on top of it; the Swift Server Workgroup maintains packages for logging, metrics, tracing, Postgres, Redis and AWS Lambda. Swift's concurrency model (actors, structured tasks, Sendable) is a good fit for request handling. A typical service builds in a Linux container or with the Static Linux SDK (Swift 6.0), which produces a single statically linked executable that runs on any distribution of the same architecture.
// swift-tools-version: 6.0// Package.swift for a cross-platform library: no Apple-only frameworksimport PackageDescription let package = Package( name: "Pricing", platforms: [.iOS(.v17), .macOS(.v14)], // minimums for Apple platforms; Linux needs no entry products: [.library(name: "Pricing", targets: ["Pricing"])], targets: [ .target(name: "Pricing"), .testTarget(name: "PricingTests", dependencies: ["Pricing"]), ])The same Pricing package can be a dependency of an iOS app and of a Vapor service, and swift test runs its tests on a Linux CI machine.
Other targets
- Android. Swift 6.3 shipped the first official Swift SDK for Android, from the Android Workgroup. You cross-compile Swift packages for Android, and the swift-java project generates bindings so Kotlin or Java code can call Swift through JNI. The usual use is sharing business logic, not writing the UI in Swift.
- WebAssembly. Swift compiles to Wasm; JavaScriptKit bridges to the browser's JavaScript, and Swift 6.4 makes the Wasm SDK available directly from swift.org.
- Windows. Toolchains and a VS Code extension are maintained on swift.org.
- Embedded Swift. A compilation mode for microcontrollers (ARM and RISC-V boards, for example) that produces small binaries by dropping runtime features such as full reflection, and by specialising all generics. It is still evolving: each release widens the supported subset, and Swift 6.4 adds existential types and richer error handling.
Interoperability
Swift can import C and Objective-C directly, and C++ interoperability (Swift 5.9 and later) lets Swift call C++ types and C++ call Swift, without bridging layers. Swift 6.3 added the @c attribute to expose Swift functions to C, and Swift 6.4 bridges Span with C++20's std::span. That's how Swift is used inside existing C and C++ codebases, piece by piece.
Tooling outside Xcode
swiftly installs and switches toolchains on Linux and macOS; SourceKit-LSP gives any editor completion and navigation; the VS Code extension adds debugging with LLDB, and since Swift 6.4 it is also published on the Open VSX Registry for other VS Code-based editors. On Linux, swift build, swift test and swift run are the whole workflow.
Check yourself
3 questions. Get them all right to finish this topic.
0 of 3 right so far. Get all three to finish this topic.