Swift

A fast, safe, modern language for everything from apps to servers.

Introduced
2014
WWDC14
Kind
Language
Runs on
Get it from
Included with Xcode, or from swift.org
iOS
iPadOS
Mac Catalyst
macOS
tvOS
visionOS
watchOS
Works in Swift Playground ›

Overview

Swift is the language Apple platforms are built around. It reads like a scripting language but compiles to fast native code, and its type system catches whole classes of bugs, like nil crashes and data races, before you run anything.

It's open source, runs on Linux, Windows and embedded devices too, and every Apple framework is designed with it in mind.

Optionals

Values that might be missing are marked in the type, so nil crashes become compile errors.

Structured concurrency

async/await, tasks and actors make concurrent code read top to bottom.

Protocols and generics

Write code once and reuse it across types without giving up speed.

Macros

Generate repetitive code at compile time. @Observable and #Preview are macros.

main.swift
struct Framework { let name: String let year: Int } let frameworks = [ Framework(name: "SwiftUI", year: 2019), Framework(name: "SwiftData", year: 2023) ] for framework in frameworks where framework.year > 2020 { print("\(framework.name) arrived in \(framework.year)") }

History

How it grew up.

2014

Introduced

Announced at WWDC14 as a modern successor to Objective-C.

2015

Open source

Swift is open-sourced, with Linux support from day one.

2019

ABI stability

Swift 5 ships in the OS, so apps no longer bundle the runtime.

2021

Concurrency

async/await and actors arrive in Swift 5.5.

2023

Macros

Swift 5.9 adds macros that generate code at compile time.

2024

Swift 6

Data-race safety is checked by the compiler.

2026

Android

Swift 6.3 ships the first official Swift SDK for Android.

Watch and learn