About Swift

Swift is the modern programming language behind the apps on your iPhone, the watch on your wrist, and increasingly the servers that power them. This chapter explains what Swift is, the principles that shaped it, and where you can run it — so the rest of the language makes sense in context.

What Swift is

Swift is a general-purpose, compiled programming language created by Apple and first released in 2014. It was designed to replace Objective-C as the primary language for building software across Apple's platforms, while being friendly enough for newcomers and powerful enough for systems-level work.

A "Hello, world!" program in Swift is a single line — there is no required boilerplate, no main function you must write by hand for a simple script:

print("Hello, world!")   // → Hello, world!

A complete Swift program.

Behind that simplicity sits a serious, modern compiler built on the LLVM toolchain. Swift code is compiled to fast native machine code, yet the language reads almost like pseudocode. That combination — approachable syntax over a high-performance core — is the heart of what Swift is.

Design goals: safe, fast, expressive

Swift's evolution is guided by three goals, in roughly this priority order.

Safe

Swift is engineered to eliminate whole categories of bugs before your app ever runs. Variables are always initialized before use, array indices are bounds-checked, integers are checked for overflow, and memory is managed automatically. The standout safety feature is optionals: a value that might be missing must be declared as optional, and you have to explicitly handle the "nothing here" case before you can use it. This turns the classic null-pointer crash into a compile-time conversation.

let name: String? = "Ada"   // optional: may hold a String or nil

if let name {           // safely unwrap before using
    print("Hello, \(name)")
}

Fast

Swift was conceived as a replacement for C-based languages, so performance is non-negotiable. Value types like structs avoid hidden heap allocations, generics are specialized by the compiler, and aggressive optimization produces tight native code. In practice Swift performs comparably to carefully written C for most application workloads.

Expressive

Swift gives you modern features that make intent clear: type inference, closures, pattern matching, generics, and protocol-oriented design. The result is code that is concise without becoming cryptic.

let scores = [88, 92, 75, 64, 99]
let passing = scores.filter { $0 >= 70 }.sorted()
print(passing)   // → [75, 88, 92, 99]

Expressive, chained operations on a collection.

Tip: When these goals conflict, Swift's evolution process favors safety first, then speed, then expressiveness. Knowing that order helps explain many of the language's design choices you'll meet later.

Where Swift runs

Swift began on Apple platforms but is now genuinely cross-platform.

The same language and standard library follow you across all of these, so skills you learn here transfer directly from an iPhone app to a Linux web server.

Swift is open source

Since late 2015, Swift has been fully open source under the Apache 2.0 license. The compiler, standard library, and core tooling are developed in the open, and the language is now stewarded by the independent Swift.org community alongside Apple. New features go through a public Swift Evolution process: anyone can read the proposals, follow the discussion, and see exactly why each feature was accepted. The cross-platform Swift Package Manager ships with the toolchain for building and sharing libraries.

Note: When you read about a new capability like typed throws or strict concurrency, there is almost always a numbered Swift Evolution proposal (an "SE" number) behind it that documents the design.

Swift, SwiftUI, and UIKit

It's easy to confuse the language with the frameworks you use it with. Keep them distinct:

NameWhat it is
SwiftThe programming language — syntax, types, control flow. The subject of this whole track.
SwiftUIA modern, declarative UI framework written in Swift. You describe what the screen should show.
UIKitThe older, imperative UI framework. Still widely used and fully supported; interoperates with SwiftUI.
FoundationA core library of everyday types (dates, data, JSON, networking) available across platforms.

You write all of these in Swift. Mastering the language first is what lets every framework on top of it click into place.

The Swift 6 era

The version you're learning is Swift 6, the current major release in 2026. It represents a milestone in Swift's safety story: the compiler now enforces data-race safety at compile time by default. The big themes of the modern era include:

Don't worry about mastering these now — each gets its own chapter later. The point is simply that the Swift you're learning is safer and more expressive than ever.

Where we go from here

You now know what Swift is, the principles behind it, where it runs, and what makes the Swift 6 era distinctive. Next we'll look at how Swift's version numbering and language modes work, so you understand exactly what "Swift 6 mode" means before we dive into writing real code.