Swift is a high-level general-purpose, multi-paradigm, compiled programming language created by Chris Lattner in 2010 for Apple Inc. and maintained by the open-source community. Swift compiles to machine code and uses an LLVM-based compiler. Swift was first released in June 2014 and the Swift toolchain has shipped in Xcode since Xcode version 6, released in September 2014.

Apple intended Swift to support many core concepts associated with Objective-C, notably dynamic dispatch, widespread late binding, extensible programming, and similar features, but in a "safer" way, making it easier to catch software bugs; Swift has features addressing some common programming errors like null pointer dereferencing and provides syntactic sugar to help avoid the pyramid of doom. Swift supports the concept of protocol extensibility, an extensibility system that can be applied to types, structs and classes, which Apple promotes as a real change in programming paradigms they term "protocol-oriented programming" (similar to traits and type classes).

Swift was introduced at Apple's 2014 Worldwide Developers Conference (WWDC). It underwent an upgrade to version 1.2 during 2014 and a major upgrade to Swift 2 at WWDC 2015. It was initially a proprietary language, but version 2.2 was made open-source software under the Apache License 2.0 on December 3, 2015, for Apple's platforms and Linux.

History

Development of Swift started in July 2010 by Chris Lattner, with the eventual collaboration of many other programmers at Apple. Swift was motivated by the need for a replacement for Apple's earlier programming language Objective-C, which had been largely unchanged since the early 1980s and lacked modern language features. Swift took language ideas "from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list". On June 2, 2014, the Apple Worldwide Developers Conference (WWDC) application became the first publicly released app written with Swift. A beta version of the programming language was released to registered Apple developers at the conference, but the company did not promise that the final version of Swift would be source code compatible with the test version. Apple planned to make source code converters available if needed for the full release.Platforms State of the Union, Session 102, Apple Worldwide Developers Conference, June 2, 2014

The Swift Programming Language, a free 500-page manual, was also released at WWDC, and is available on the Apple Books Store and the official website.

Swift reached the 1.0 milestone on September 9, 2014, with the Gold Master of Xcode 6.0 for iOS. Swift 1.1 was released on October 22, 2014, alongside the launch of Xcode 6.1. Swift 1.2 was released on April 8, 2015, along with Xcode 6.3. Swift 2.0 was announced at WWDC 2015, and was made available for publishing apps in the App Store on September 21, 2015.

Swift 3.0 was released on September 13, 2016. Through version 3.0, the syntax of Swift went through significant evolution, with the core team making source stability a focus in later versions.

Swift 4.0, released on September 19, 2017, introduced several changes to some built-in classes and structures. Code written with previous versions of Swift can be updated using the migration functionality built into Xcode. Swift 4.1 was released on March 29, 2018. In the first quarter of 2018, Swift surpassed Objective-C in measured popularity.

Swift 5, released in March 2019, introduced a stable binary interface on Apple platforms, allowing the Swift runtime to be incorporated into Apple operating systems. It is source compatible with Swift 4.

Swift 5.1 was officially released in September 2019. Swift 5.1 builds on the previous version of Swift 5 by extending the stable features of the language to compile-time with the introduction of module stability. The introduction of module stability makes it possible to create and share binary frameworks that will work with future releases of Swift. Swift 5.5, officially announced by Apple at the 2021 WWDC, significantly expands language support for concurrency and asynchronous code, notably introducing a unique version of the actor model. Swift 5.9, was released in September 2023 and includes a macro system, generic parameter packs, and ownership features like the new consume operator. Swift 5.10, released in March 2024, improves the language's concurrency model, allowing for full data isolation to prevent data races.

Swift 6 was released in September 2024. Swift 6.1 was released in March 2025. It includes "new language enhancements to improve productivity, diagnostics improvements, package traits, and ongoing work to improve data-race safety usability and compile times."

Swift won first place for Most Loved Programming Language in the Stack Overflow Developer Survey 2015 and second place in 2016.

On December 3, 2015, the Swift language, supporting libraries, debugger, and package manager were open-sourced under the Apache 2.0 license with a Runtime Library Exception, and Swift.org was created to host the project. The source code is hosted on GitHub, where it is easy for anyone to get the code, build it themselves, and even create pull requests to contribute code back to the project.

In December 2015, IBM announced its Swift Sandbox website, which allows developers to write Swift code in one pane and display output in another. The Swift Sandbox was deprecated in January 2018.

During the WWDC 2016, Apple announced an iPad exclusive app, named Swift Playgrounds, intended to teach people how to code in Swift. The app is presented in a 3D video game-like interface which provides feedback when lines of code are placed in a certain order and executed.

In January 2017, Chris Lattner announced his departure from Apple for a new position with Tesla Motors, with the Swift project lead role going to team veteran Ted Kremenek.

During WWDC 2019, Apple announced SwiftUI with Xcode 11, which provides a framework for declarative UI structure design across all Apple platforms.

Official downloads of the SDK and toolchain for the Ubuntu distribution of Linux have been available since Swift 2.2, with more distros added since Swift 5.2.4, CentOS and Amazon Linux. There is an unofficial SDK and native toolchain package for Android, and in October 2025 Swift's Android workgroup announced a preview release of the official Swift SDK for Android.

Platforms The platforms Swift supports are Apple's operating systems (Darwin, iOS, iPadOS, macOS, tvOS, watchOS), Linux, Windows, WebAssembly, and Android.

A key aspect of Swift's design is its ability to interoperate with the huge body of existing Objective-C code developed for Apple products over the previous decades, such as Cocoa and the Cocoa Touch frameworks. On Apple platforms, it links with the Objective-C runtime library, which allows C, Objective-C, C++ and Swift code to run within one program.

Version history Swiftversion Release date macOS Linux Windows 1.0 September 9, 2014 1.1 October 22, 2014 1.2 April 8, 2015 2.0 September 21, 2015 2.1 October 20, 2015 2.2 March 21, 2016 2.2.1 May 3, 2016 3.0 September 13, 2016 3.0.1 October 28, 2016 3.0.2 December 13, 2016 3.1 March 27, 2017 3.1.1 April 21, 2017 4.0 September 19, 2017 4.0.2 November 1, 2017 4.0.3 December 5, 2017 4.1 March 29, 2018 4.1.1 May 4, 2018 4.1.2 May 31, 2018 4.1.3 July 27, 2018 4.2 September 17, 2018 4.2.1 October 30, 2018 4.2.2 February 4, 2019 4.2.3 February 28, 2019 4.2.4 March 29, 2019 5.0 March 25, 2019 5.0.1 April 18, 2019 5.0.2 July 15, 2019 5.0.3 August 30, 2019 5.1 September 10, 2019 5.1.1 October 11, 2019 5.1.2 November 7, 2019 5.1.3 December 13, 2019 5.1.4 January 31, 2020 5.1.5 March 9, 2020 5.2 March 24, 2020 5.2.1 March 30, 2020 5.2.2 April 15, 2020 5.2.3 April 29, 2020 5.2.4 May 20, 2020 5.2.5 August 5, 2020 5.3 September 16, 2020 5.3.1 November 13, 2020 5.3.2 December 15, 2020 5.3.3 January 25, 2021 5.4 April 26, 2021 5.4.1 May 25, 2021 5.4.2 June 28, 2021 5.4.3 September 9, 2021 5.5 September 20, 2021 5.5.1 October 27, 2021 5.5.2 December 14, 2021 5.5.3 February 9, 2022 5.6 March 14, 2022 5.6.1 April 9, 2022 5.6.2 June 15, 2022 5.6.3 September 2, 2022 5.7 September 12, 2022 5.7.1 November 1, 2022 5.8 March 30, 2023 5.8.1 June 1, 2023 5.9 September 18, 2023 5.9.1 October 19, 2023 5.9.2 December 11, 2023 5.10 March 5, 2024 5.10.1 June 5, 2024 6.0 September 16, 2024 6.1 March 31, 2025 6.2 September 17, 2025 6.3 March 27, 2026

Features

Swift is a general-purpose programming language that employs modern programming-language theory concepts and strives to present a simple, yet powerful syntax. Swift incorporates innovations and conventions from various programming languages, with notable inspiration from Objective-C, which it replaced as the primary development language on Apple platforms.

Swift was designed to be safe and friendly to new programmers while not sacrificing speed. By default Swift manages all memory automatically and ensures variables are always initialized before use. Array accesses are checked for out-of-bounds errors and integer operations are checked for overflow. Parameter names allow creating clear APIs. Protocols define interfaces that types may adopt, while extensions allow developers to add more function to existing types. Swift enables object-oriented programming with the support for classes, subtyping, and method overriding. Optionals allow nil values to be handled explicitly and safely. Concurrent programs can be written using async/await syntax, and actors isolate shared mutable state in order to eliminate data races.

Basic syntax Swift's syntax is similar to C-style languages. Code begins executing in the global scope by default. Alternatively, the attribute can be applied to a structure, class, or enumeration declaration to indicate that it contains the program's entry point.

Swift's "Hello, World!" program is:print("Hello, world!")The function used here is included in Swift's standard library, which is available to all programs without the need to import external modules. Statements in Swift don't have to end with a semicolon, however semicolons are required to separate multiple statements written on the same line. Single-line comments begin with and continue until the end of the current line. Multiline comments are contained by and characters.

Constants (variables which cannot be modified) are declared with the keyword, while variables declared using the keyword can change. Values must be initialised before they are read. Variables may infer their type based on the type of the provided initial value. If the initial value is set after the value's declaration, a type must be declared explicitly.let highScoreThreshold = 1000 // A constant with type Int. The type was inferred based on the provided value.

var currentScore = 980 // A variable with type Int. currentScore = 1200 // The value of variables can change over time.

let playerMessage: String // A constant with explicit type String. if currentScore > highScoreThreshold { playerMessage = "You are a top player!" } else { playerMessage = "Better luck next time." }

print(playerMessage) // Prints "You are a top player!"Control flow in Swift is managed with if-else, guard, and switch statements, along with while and for-in loops.

The statements take a Boolean parameter and execute the body of the statement if the condition is true, otherwise it executes the optional body. syntax provides syntactic sugar for checking for the existence of an optional value and unwrapping it at the same time.let someNumber = 42 if someNumber % 2 == 0 { // Use the remainder operator to find the remainder of someNumber divided by 2. print("\(someNumber) is even.") } else { print("\(someNumber) is odd.") }