Introduction to Swift
Swift is a compiled, statically typed language created by Apple, used for iOS and macOS development as well as general-purpose programming on Linux. Unlike Java, Kotlin, C#, or JavaScript on this site, Swift doesn't use a garbage collector — it uses ARC (Automatic Reference Counting), which tracks how many references point to an object and deallocates it the moment that count hits zero, giving deterministic cleanup without the manual memory management of C or C++.
Swift's other signature feature is optionals: a type like String can never hold 'no value' — only String? can, and the compiler forces you to handle that possibility before you can use what's inside. This course covers that, along with structs as Swift's default, idiomatic way to model data, protocols, enums with associated values, and closures.
A quick preview
Here's a real Swift program, executed for real on this page's own compiler — not a mockup:
print("Swift: compiled, statically typed, and uses ARC instead of garbage collection.")Swift: compiled, statically typed, and uses ARC instead of garbage collection.
No class, no main function — just a single top-level statement. The next lesson runs your first full program and explains exactly what's happening.
Practice exercise
Declare a constant named version holding the Int value 14, then print the string "Swift version: " followed by its value using string interpolation.