Paste the snippet above (or your own Swift code) and run it there — real compilation, real output.
Why this links out instead of embedding
Swift has no official web-based playground — Apple's own Swift Playgrounds is a native macOS/iPadOS app, not a website. Compiler Explorer fills that gap with a genuine Swift compiler running server-side, which is a more honest option than simulating Swift's runtime behavior (ARC, optionals, protocol witness tables) in JavaScript.
About Compiler Explorer
Compiler Explorer (Godbolt) is a widely-used, open-source online compiler exploration tool supporting 30+ languages, including Swift, running on real toolchains rather than reimplementations. It performs around 3 million compilations a week and is a standard reference tool across the systems-programming community.
What to try next
- Swift language reference — 30 topic pages
- Swift snippets — copy-ready idiomatic patterns
- Learn Swift — structured lessons