Swift · online compiler

Run Swift online

Run Swift online — Swift 5 and 6, browser-hosted, no Xcode.

Available versions
Firecracker microVM live per-test verdicts multi-file compile

Swift is Apple's modern language for iOS, macOS, and (increasingly) server-side. Strong types, value semantics, protocols with associated types, and — since Swift 6 — data-race safety by default.

ls-judge runs the Linux Swift toolchain (no Xcode needed) inside a Firecracker microVM.

Starter code

What you get in Swift

Clicking "Run now" opens the playground with this exact code and a matching test case pre-loaded — passes on first Run.

swift
Swift 6
import Foundation
let line = readLine()!
let n = Int(line.trimmingCharacters(in: .whitespaces))!
print(n * 2)
stdin →21
expected →42
FAQ

Common questions about Swift on ls-judge

Swift 5 or 6?
Both — the picker lets you choose.
Swift Package Manager?
No network — single-file compile only.
UIKit / SwiftUI?
No — this is server-side Swift on Linux, no Apple frameworks.
Free?
Yes.
Further reading
Also try