Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Swift (programming language)

From Wikipedia, the free encyclopedia
Apple's general-purpose, open source, compiled programming language.
This article is about the Apple programming language and is not to be confused withSwift (parallel scripting language) orSwift (CPU).

Swift
Swift Logo
ParadigmMulti-paradigm:protocol-oriented,object-oriented,functional,imperative,block structured,declarative,concurrent
Designed byChris Lattner, Doug Gregor, John McCall, Ted Kremenek, Joe Groff, andApple Inc.[1]
DeveloperApple Inc. and open-source contributors
First appearedJune 2, 2014; 11 years ago (2014-06-02)[2]
Stable release
6.2.1[3] Edit this on Wikidata / 4 November 2025; 19 days ago (4 November 2025)
Preview release
6.2
Typing disciplineStatic,strong,inferred
Memory managementAutomatic Reference Counting
OSApple's operating systems (Darwin,iOS,iPadOS,macOS,tvOS,visionOS,watchOS),Linux,Windows,FreeBSD,Android,z/OS
LicenseApache License 2.0 (Swift 2.2 and later)
Proprietary (up to Swift 2.2)[4][5]
Filename extensions.swift, .SWIFT
Website
Majorimplementations
swiftc,silver
Influenced by
Objective-C,[6]Rust,Haskell,Ruby,Python,C#,CLU,[7]D[8]
Influenced
Rust,[9]V (Vlang),[10]Mojo,[11]Carbon[12]

Swift is ahigh-levelgeneral-purpose,multi-paradigm,compiledprogramming language created byChris Lattner in 2010 forApple Inc. and maintained bythe open-source community. Swift compiles to machine code and uses anLLVM-based compiler. Swift was first released in June 2014[13] and the Swift toolchain has shipped inXcode since Xcode version 6, released in September 2014.

Apple intended Swift to support many core concepts associated withObjective-C, notablydynamic dispatch, widespreadlate binding,extensible programming, and similar features, but in a "safer" way, making it easier to catchsoftware bugs; Swift has features addressing some common programming errors likenull pointerdereferencing and providessyntactic sugar to help avoid thepyramid of doom. Swift supports the concept ofprotocol extensibility, an extensibility system that can be applied to types,structs andclasses, which Apple promotes as a real change in programming paradigms they term "protocol-oriented programming"[14] (similar totraits andtype classes).[15]

Swift was introduced at Apple's2014 Worldwide Developers Conference (WWDC).[16] It underwent an upgrade to version 1.2 during 2014 and a major upgrade to Swift 2 at WWDC 2015. It was initially aproprietary language, but version 2.2 was madeopen-source software under theApache License 2.0 on December 3, 2015, for Apple's platforms andLinux.[17][18]

History

[edit]
This section mayrequirecleanup to meet Wikipedia'squality standards. The specific problem is:Information needs to be organized, preferably by someone with knowledge of programming language development. Please helpimprove this section if you can.(May 2025) (Learn how and when to remove this message)

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

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

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

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

Swift 4.0, released on September 19, 2017,[28] 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.[29] In the first quarter of 2018, Swift surpassedObjective-C in measured popularity.[30]

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.[31]

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.[32] Swift 5.5, officially announced by Apple at the 2021 WWDC, significantly expands language support forconcurrency andasynchronous code, notably introducing a unique version of theactor model.[33] Swift 5.9, was released in September 2023 and includes a macro system, generic parameter packs, and ownership features like the newconsume operator.[34] Swift 5.10, released in March 2024, improves the language's concurrency model, allowing for full data isolation to preventdata races.

Swift 6 was released in September 2024.[35] 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."[36]

Swift won first place forMost Loved Programming Language in theStack Overflow Developer Survey 2015[37] and second place in 2016.[38]

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,[39] andSwift.org was created to host the project. The source code is hosted onGitHub, 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.[40][41][42] The Swift Sandbox was deprecated in January 2018.[43]

During theWWDC 2016, Apple announced aniPad exclusiveapp, namedSwift Playgrounds, intended to teach people how to code in Swift. The app is presented in a3D video game-like interface which provides feedback when lines of code are placed in a certain order and executed.[44][45][46]

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

During WWDC 2019, Apple announcedSwiftUI with Xcode 11, which provides a framework fordeclarative UI structure design across all Apple platforms.[49]

Official downloads of theSDK andtoolchain for theUbuntu distribution ofLinux have been available since Swift 2.2, with more distros added since Swift 5.2.4,CentOS and Amazon Linux.[50] There is an unofficial SDK and native toolchain package forAndroid,[51][52] and in October 2025 Swift's Android workgroup announced a preview release of the official Swift SDK for Android.[53]

Platforms

[edit]

The platforms Swift supports are Apple's operating systems (Darwin,iOS,iPadOS,macOS,tvOS,watchOS),Linux,Windows,WebAssembly, andAndroid.[54][55]

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 asCocoa and theCocoa Touchframeworks. On Apple platforms,[56] it links with the Objective-Cruntime library, which allowsC,Objective-C,C++ and Swift code to run within one program.[57]

Version history

[edit]
Swift
version
Release datemacOSLinuxWindows
1.0September 9, 2014YesNoNo
1.1October 22, 2014YesNoNo
1.2April 8, 2015YesNoNo
2.0September 21, 2015YesNoNo
2.1October 20, 2015YesNoNo
2.2March 21, 2016YesYesNo
2.2.1May 3, 2016YesYesNo
3.0September 13, 2016YesYesNo
3.0.1October 28, 2016YesYesNo
3.0.2December 13, 2016YesYesNo
3.1March 27, 2017YesYesNo
3.1.1April 21, 2017YesYesNo
4.0September 19, 2017YesYesNo
4.0.2November 1, 2017YesYesNo
4.0.3December 5, 2017YesYesNo
4.1March 29, 2018YesYesNo
4.1.1May 4, 2018NoYesNo
4.1.2May 31, 2018YesYesNo
4.1.3July 27, 2018NoYesNo
4.2September 17, 2018YesYesNo
4.2.1October 30, 2018YesYesNo
4.2.2February 4, 2019NoYesNo
4.2.3February 28, 2019NoYesNo
4.2.4March 29, 2019NoYesNo
5.0[58]March 25, 2019YesYesNo
5.0.1April 18, 2019YesYesNo
5.0.2July 15, 2019NoYesNo
5.0.3August 30, 2019NoYesNo
5.1September 10, 2019YesYesNo
5.1.1October 11, 2019NoYesNo
5.1.2November 7, 2019YesYesNo
5.1.3December 13, 2019YesYesNo
5.1.4January 31, 2020NoYesNo
5.1.5March 9, 2020NoYesNo
5.2March 24, 2020YesYesNo
5.2.1March 30, 2020NoYesNo
5.2.2April 15, 2020YesYesNo
5.2.3April 29, 2020NoYesNo
5.2.4May 20, 2020YesYesNo
5.2.5August 5, 2020NoYesNo
5.3September 16, 2020YesYesYes[59]
5.3.1November 13, 2020YesYesYes
5.3.2December 15, 2020YesYesYes
5.3.3January 25, 2021NoYesYes
5.4[60]April 26, 2021YesYesYes
5.4.1May 25, 2021NoYesYes
5.4.2June 28, 2021YesYesYes
5.4.3September 9, 2021NoYesYes
5.5September 20, 2021YesYesYes
5.5.1October 27, 2021YesYesYes
5.5.2December 14, 2021YesYesYes
5.5.3February 9, 2022NoYesYes
5.6[61]March 14, 2022YesYesYes
5.6.1[62]April 9, 2022NoYesYes
5.6.2[63]June 15, 2022NoYesYes
5.6.3[64]September 2, 2022NoYesYes
5.7[65]September 12, 2022YesYesYes
5.7.1[66]November 1, 2022YesYesYes
5.8[67]March 30, 2023YesYesYes
5.8.1[68]June 1, 2023YesYesYes
5.9[69]September 18, 2023YesYesYes
5.9.1[70]October 19, 2023YesYesYes
5.9.2[71]December 11, 2023YesYesYes
5.10[72]March 5, 2024YesYesYes
5.10.1[73]June 5, 2024YesYesYes
6.0[74]September 16, 2024YesYesYes
6.1[75]March 31, 2025YesYesYes
6.2[76]September 17, 2025YesYesYes

Features

[edit]
This sectionmay be too technical for most readers to understand. Pleasehelp improve it tomake it understandable to non-experts, without removing the technical details.(June 2018) (Learn how and when to remove this message)

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 enablesobject-oriented programming with the support forclasses,subtyping, andmethod overriding. Optionals allownil values to be handled explicitly and safely. Concurrent programs can be written usingasync/await syntax, andactors isolate shared mutable state in order to eliminate data races.[77][78]

Basic syntax

[edit]

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

Swift's"Hello, World!" program is:

print("Hello, world!")

Theprint(_:separator:terminator:) 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-linecomments begin with// and continue until the end of the current line. Multiline comments are contained by/* and*/ characters.Constants are declared with thelet keyword and variables with thevar keyword. Values must be initialized before they are read. Values 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.[79]

lethighScoreThreshold=1000// A constant with type Int. The type was inferred based on the provided value.varcurrentScore=980// A variable with type Int.currentScore=1200// The value of variables can change over time.letplayerMessage:String// A constant with explicit type String.ifcurrentScore>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 withif-else,guard, andswitch statements, along withwhile andfor-in loops.Theif statements take a Boolean parameter and execute the body of theif statement if the condition is true, otherwise it executes the optionalelse body.if-let syntax provides syntactic sugar for checking for the existence of an optional value and unwrapping it at the same time.

letsomeNumber=42ifsomeNumber%2==0{// Use the remainder operator to find the remainder of someNumber divided by 2.print("\(someNumber) is even.")}else{print("\(someNumber) is odd.")}// Prints "42 is even."

Functions are defined with thefunc keyword. Function parameters may have names which allow function calls to read like phrases. An underscore before the parameter name allows the argument label to be omitted from the call site.Tuples can be used by functions to return multiple pieces of data at once.

funcconstructGreeting(forname:String)->String{return"Hello\(name)!"}letgreeting=constructGreeting(for:"Craig")print(greeting)// Prints "Hello Craig!"

Functions, and anonymous functions known asclosures, can be assigned to properties and passed around the program like any other value.

funcdivideByTwo(_aNum:Int)->Int{returnaNum/2}funcmultiplyByTwo(_aNum:Int)->Int{returnaNum*2}letmathOperation=multiplyByTwoprint(mathOperation(21))// Prints "42"

guard statements require that the given condition is true before continuing on past theguard statement, otherwise the body of the providedelse clause is run. Theelse clause must exit control of the code block in which theguard statement appears.guard statements are useful for ensuring that certain requirements are met before continuing on with program execution. In particular they can be used to create an unwrapped version of an optional value that is guaranteed to be non-nil for the remainder of the enclosing scope.

funcdivide(numerator:Int?,byDenominatordenominator:Int)->Int?{guarddenominator!=0else{print("Can't divide by 0.")returnnil}guardletnumeratorelse{print("The provided numerator is nil.")returnnil}returnnumerator/denominator}letresult=divide(numerator:3,byDenominator:0)print("Division result is:\(result)")// Prints:// "Can't divide by 0."// "Division result is: nil."

switch statements compare a value with multiple potential values and then executes an associated code block.switch statements must be made exhaustive, either by including cases for all possible values or by including adefault case which is run when the provided value doesn't match any of the other cases.switch cases do not implicitly fall through, although they may explicitly do so with thefallthrough keyword.Pattern matching can be used in various ways insideswitch statements. Here is an example of an integer being matched against a number of potential ranges:

letsomeNumber=42switchsomeNumber{case..<0:print("\(someNumber) negative.")case0:print("\(someNumber) is 0.")case1...9:print("\(someNumber) greater than 0, but less than 10.")default:print("\(someNumber) is greater than 9.")}// Prints "42 is greater than 9."

for-in loops iterate over a sequence of values:

letnames=["Will","Anna","Bart"]fornameinnames{print(name)}// Prints:// Will// Anna// Bart

while loops iterate as long as the given Boolean condition evaluates totrue:

// Add together all the numbers from 1 to 5.vari=1varresult=0whilei<=5{// The loop performs its body as long as i is less than or equal to 5.result+=i// Add i to the current result.i+=1// Increment i by 1.}print(result)// Prints "15"

Closure support

[edit]

Swift supportsclosures, which are self-contained blocks of functionality that can be passed around and used in code,[81] and can also be used asanonymous functions. Here are some examples:

// Closure type, defined by its input and output values, can be specified outside the closure:letclosure1:(Int,Int)->Int={arg1,arg2inreturnarg1+arg2}// …or inside it:letclosure2={(arg1:Int,arg2:Int)->Intinreturnarg1+arg2}// In most cases, closure's return type can be inferred automatically by the compiler.letclosure3={arg1:Int,arg2:Intinreturnarg1+arg2}

Closures can be assigned to variables and constants, and can be passed into other functions or closures as parameters. Single-expression closures may drop thereturn keyword.

Swift also has a trailing closure syntax, which allows the closure to be written after the end of the function call instead of within the function's parameter list. Parentheses can be omitted altogether if the closure is the function's only parameter:

// This function takes a closure which receives no input parameters and returns an integer,// evaluates it, and uses the closure's return value (an Int) as the function's return value.funcfoo(closurebar:()->Int)->Int{returnbar()}// Without trailing closure syntax:foo(closure:{return1})// With trailing closure syntax, and implicit return:foo{1}

Starting from version 5.3, Swift supports multiple trailing closures:[82]

// This function passes the return of the first closure as the parameter of the second,// and returns the second closure's result:funcfoo(bar:()->Int,baz:(Int)->Int)->Int{returnbaz(bar())}// With no trailing closures:foo(bar:{return1},baz:{xinreturnx+1})// With 1 trailing closure:foo(bar:{return1}){xinreturnx+1}// With 2 trailing closures (only the first closure's argument name is omitted):foo{return1}baz:{xinreturnx+1}

Swift will provide shorthand argument names for inline closures, removing the need to explicitly name all of the closures parameters.[83] Arguments can be referred to with the names $0, $1, $2, and so on:

letnames=["Josephine","Steve","Chris","Barbara"]// filter calls the given closure for each value in names.// Values with a character count less than 6 are kept, the others are dropped.letshortNames=names.filter{$0.count<6}print(shortNames)// Prints "["Steve", "Chris"]"

Closures may capture values from their surrounding scope. The closure will refer to this captured value for as long as the closure exists:

funcmakeMultiplier(withMultiplemultiple:Int)->(Int)->(Int){// Create and return a closure that takes in an Int and returns the input multiplied by the value of multiple.return{$0*multiple}}letmultiplier=makeMultiplier(withMultiple:3)print(multiplier(3))// Prints "9"print(multiplier(10))// Prints "30"

String support

[edit]

The Swift standard library includes unicode-compliantString andCharacter types. String values can be initialized with a String literal, a sequence of characters surrounded by double quotation marks. Strings can be concatenated with the+ operator:

varsomeString="Hello,"someString+=" world!"

String interpolation allows for the creation of a new string from other values and expressions. Values written between parentheses preceded by a\ will be inserted into the enclosing string literal:[84]

varcurrentScore=980print("Your score is\(currentScore).")// Prints "Your score is 980."

A for-in loop can be used to iterate over the characters contained in a string:

forcharacterin"Swift"{print(character)}// S// w// i// f// t

If the Foundation framework is imported, Swift invisibly bridges the String type to NSString (the String class commonly used in Objective-C).

Callable objects

[edit]
This section is an excerpt fromCallable object § In Swift.[edit]

In Swift, callable objects are defined usingcallAsFunction.[85]

structCallableStruct{varvalue:IntfunccallAsFunction(_number:Int,scale:Int){print(scale*(number+value))}}letcallable=CallableStruct(value:100)callable(4,scale:2)callable.callAsFunction(4,scale:2)// Both function calls print 208.

Access control

[edit]

Swift supports fiveaccess control levels for symbols:open,public,internal,fileprivate, andprivate. Unlike many object-oriented languages, these access controls ignoreinheritance hierarchies:private indicates that a symbol is accessible only in the immediatescope,fileprivate indicates it is accessible only from within the file,internal indicates it is accessible within the containing module,public indicates it is accessible from any module, andopen (only for classes and their methods) indicates that the class may be subclassed outside of the module.[86]

Optionals and chaining

[edit]

An important feature in Swift isoption types, which allowreferences or values to operate in a manner similar to the common pattern inC, where apointer may either refer to a specific value or no value at all. This implies that non-optional types cannot result in anull-pointer error; the compiler can ensure this is not possible.

Optional types are created with theOptional enum. To make an Integer that is nullable, one would use a declaration similar tovar optionalInteger: Optional<Int>. As in C#,[87] Swift also includes syntactic sugar for this, allowing one to indicate a variable is optional by placing a question mark after the type name,var optionalInteger: Int?.[88] Variables or constants that are marked optional either have a value of the underlying type or arenil. Optional typeswrap the base type, resulting in a different instance.String andString? are fundamentally different types, the former is of typeString while the latter is anOptional that may be holding someString value.

To access the value inside, assuming it is not nil, it must beunwrapped to expose the instance inside. This is performed with the! operator:

letmyValue=anOptionalInstance!.someMethod()

In this case, the! operator unwrapsanOptionalInstance to expose the instance inside, allowing the method call to be made on it. IfanOptionalInstance is nil, a null-pointer error occurs, terminating the program. This is known as force unwrapping. Optionals may be safely unwrapped usingoptional chaining which first tests whether the instance is nil, and then unwrap it if it is non-null:

letmyValue=anOptionalInstance?.someMethod()

In this case the runtime callssomeMethod only ifanOptionalInstance is not nil, suppressing the error. A? must be placed after every optional property. If any of these properties are nil the entire expression evaluates as nil. The origin of the termchaining comes from the more common case where several method calls/getters are chained together. For instance:

letaTenant=aBuilding.tenantList[5]lettheirLease=aTenant.leaseDetailsletleaseStart=theirLease?.startDate

can be reduced to:

letleaseStart=aBuilding.tenantList[5].leaseDetails?.startDate

Swift's use of optionals allows the compiler to usestatic dispatch because the unwrapping action is called on a defined instance (the wrapper), versus occurring in a runtime dispatch system.

Value types

[edit]

In many object-oriented languages, objects are represented internally in two parts. The object is stored as a block of data placed on theheap, while the name (or "handle") to that object is represented by apointer. Objects are passed between methods by copying the value of the pointer, allowing the same underlying data on the heap to be accessed by anyone with a copy. In contrast, basic types like integers and floating-point values are represented directly; the handle contains the data, not a pointer to it, and that data is passed directly to methods by copying. These styles of access are termedpass-by-reference in the case of objects, andpass-by-value for basic types.

Both concepts have their advantages and disadvantages. Objects are useful when the data is large, like the description of a window or the contents of a document. In these cases, access to that data is provided by copying a 32- or 64-bit value, versus copying an entire data structure. However, smaller values like integers are the same size as pointers (typically both are oneword), so there is no advantage to passing a pointer, versus passing the value.

Swift offers built-in support for objects using either pass-by-reference or pass-by-value semantics, the former using theclass declaration and the latter usingstruct. Structs in Swift have almost all the same features as classes: methods, implementing protocols and using the extension mechanisms. For this reason, Apple terms all data generically asinstances, versus objects or values. Structs do not support inheritance, however.[89]

The programmer is free to choose which semantics are more appropriate for each data structure in the application. Larger structures like windows would be defined as classes, allowing them to be passed around as pointers. Smaller structures, like a 2D point, can be defined as structs, which will be pass-by-value and allow direct access to their internal data with no indirection or reference counting. The performance improvement inherent to the pass-by-value concept is such that Swift uses these types for almost all common data types, includingInt andDouble, and types normally represented by objects, likeString andArray.[89] Using value types can result in significant performance improvements in user applications as well.[90]

Array,Dictionary, andSet all utilizecopy on write so that their data are copied only if and when the program attempts to change a value in them. This means that the various accessors have what is in effect a pointer to the same data storage. So while the data is physically stored as one instance in memory, at the level of the application, these values are separate and physical separation is enforced by copy on write only if needed.[91]

Extensions

[edit]

Extensions add new functionality to an existing type, without the need to subclass or even have access to the original source code. Extensions can add new methods, initializers, computed properties, subscripts, and protocol conformances.[92] An example might be to add a spell checker to the baseString type, which means all instances ofString in the program gain the ability to spell-check. The system is also widely used as an organizational technique, allowing related code to be gathered into library-like extensions.

Extensions are declared with theextension keyword.

structRectangle{letwidth:Doubleletheight:Double}extensionRectangle{vararea:Double{returnheight*width}}

Protocol-oriented programming

[edit]

Protocols promise that a particular type implements a set of methods or properties, meaning that other instances in the system can call those methods on any instance implementing that protocol. This is often used in modern object-oriented languages as a substitute formultiple inheritance, although the feature sets are not entirely similar.

In Objective-C, and most other languages implementing the protocol concept, it is up to the programmer to ensure that the required methods are implemented in each class.[93] Swift adds the ability to add these methods using extensions, and to usegeneric programming (generics) to implement them. Combined, these allow protocols to be written once and support a wide variety of instances. Also, the extension mechanism can be used to add protocol conformance to an object that does not list that protocol in its definition.[94]

For example, a protocol might be declared calledPrintable, which ensures that instances that conform to the protocol implement adescription property and aprintDetails() method requirement:

// Define a protocol named PrintableprotocolPrintable{vardescription:String{get}// A read-only property requirementfuncprintDetails()// A method requirement}

This protocol can now be adopted by other types:

// Adopt the Printable protocol in a classclassMyClass:Printable{vardescription:String{return"An instance of MyClass"}funcprintDetails(){print(description)}}

Extensions can be used to add protocol conformance to types. Protocols themselves can also be extended to provide default implementations of their requirements. Adopters may define their own implementations, or they may use the default implementation:

extensionPrintable{// All Printable instances will receive this implementation, or they may define their own.funcprintDetails(){print(description)}}// Bool now conforms to Printable, and inherits the printDetails() implementation above.extensionBool:Printable{vardescription:String{return"An instance of Bool with value:\(self)"}}

In Swift, like many modern languages supporting interfaces, protocols can be used as types, which means variables and methods can be defined by protocol instead of their specific type:

funcgetSomethingPrintable()->anyPrintable{returntrue}varsomeSortOfPrintableInstance=getSomethingPrintable()print(someSortOfPrintableInstance.description)// Prints "An instance of Bool with value: true"

It does not matter what concrete type ofsomeSortOfPrintableInstance is, the compiler will ensure that it conforms to the protocol and thus this code is safe. This syntax also means that collections can be based on protocols also, likelet printableArray = [any Printable].

Both extensions and protocols are used extensively in Swift's standard library; in Swift 5.9, approximately 1.2 percent of all symbols within the standard library were protocols, and another 12.3 percent were protocol requirements or default implementations.[95] For instance, Swift uses extensions to add theEquatable protocol to many of their basic types, like Strings and Arrays, allowing them to be compared with the== operator. TheEquatable protocol also defines this default implementation:

func!=<T:Equatable>(lhs:T,rhs:T)->Bool

This function defines a method that works on any instance conforming toEquatable, providing anot equals operator. Any instance, class or struct, automatically gains this implementation simply by conforming toEquatable.[96]

Protocols, extensions, and generics can be combined to create sophisticated APIs. For example, constraints allow types to conditionally adopt protocols or methods based on the characteristics of the adopting type. A common use case may be adding a method on collection types only when the elements contained within the collection areEquatable:

extensionArraywhereElement:Equatable{// allEqual will be available only on instances of Array that contain Equatable elements.funcallEqual()->Bool{forelementinself{ifelement!=self.first{returnfalse}}returntrue}}

Concurrency

[edit]

Swift 5.5 introduced structured concurrency into the language.[97] Structured concurrency usesAsync/await syntax similar to Kotlin, JavaScript, and Rust. An async function is defined with theasync keyword after the parameter list. When calling an async function theawait keyword must be written before the function to indicate that execution will potentially suspend while calling function. While a function is suspended the program may run some other concurrent function in the same program. This syntax allows programs to clearly call out potential suspension points and avoid a version of thePyramid of Doom caused by the previously widespread use of closure callbacks.[98]

funcdownloadText(name:String)async->String{letresult=// ... some asynchronous downloading code ...returnresult}lettext=awaitdownloadText("text1")

Theasync let syntax allows multiple functions to run in parallel.await is again used to mark the point at which the program will suspend to wait for the completion of theasync functions called earlier.

// Each of these calls to downloadText will run in parallel.asynclettext1=downloadText(name:"text1")asynclettext2=downloadText(name:"text2")asynclettext3=downloadText(name:"text3")lettextToPrint=await[text1,text2,text3]// Suspends until all three downloadText calls have returned.print(textToPrint)

Tasks and TaskGroups can be created explicitly to create a dynamic number of child tasks during runtime:

lettaskHandle=Task{awaitdownloadText(name:"someText")}letresult=awaittaskHandle.value

Swift uses theActor model to isolate mutable state, allowing different tasks to mutate shared state in a safe manner. Actors are declared with theactor keyword and are reference types, like classes. Only one task may access the mutable state of an actor at the same time. Actors may access and mutate their own internal state freely, but code running in separate tasks must mark each access with theawait keyword to indicate that the code may suspend until other tasks finish accessing the actor's state.

actorDirectory{varnames:[String]=[]funcadd(name:String){names.append(name)}}letdirectory=Directory()// Code suspends until other tasks finish accessing the actor.awaitdirectory.add(name:"Tucker")print(awaitdirectory.names)

Libraries, runtime, development

[edit]

On Apple systems, Swift uses the same runtime as the extantObjective-C system, but requires iOS 7 or macOS 10.9 or higher. It also depends onGrand Central Dispatch.[99] Swift and Objective-C code can be used in one program, and by extension, C and C++ also. Beginning in Swift 5.9,C++ code can be used directly from Swift code.[100] In the case of Objective-C, Swift has considerable access to the object model, and can be used to subclass, extend and use Objective-C code to provide protocol support.[101] The converse is not true: a Swift class cannot be subclassed in Objective-C.[102]

To aid development of such programs, and the re-use of extant code, Xcode 6 and higher offers a semi-automated system that builds and maintains abridging header to expose Objective-C code to Swift. This takes the form of an additionalheader file that simply defines or imports all of the Objective-C symbols that are needed by the project's Swift code. At that point, Swift can refer to the types, functions, and variables declared in those imports as though they were written in Swift. Objective-C code can also use Swift code directly, by importing an automatically maintained header file with Objective-C declarations of the project's Swift symbols. For instance, an Objective-C file in a mixed project called "MyApp" could access Swift classes or functions with the code#import "MyApp-Swift.h". Not all symbols are available through this mechanism, however—use of Swift-specific features like generic types, non-object optional types, sophisticated enums, or even Unicode identifiers may render a symbol inaccessible from Objective-C.[103]

Swift also has limited support forattributes, metadata that is read by the development environment, and is not necessarily part of the compiled code. Like Objective-C, attributes use the@ syntax, but the currently available set is small. One example is the@IBOutlet attribute, which marks a given value in the code as anoutlet, available for use withinInterface Builder (IB). Anoutlet is a device that binds the value of the on-screen display to an object in code.

On non-Apple systems, Swift does not depend on an Objective-C runtime or other Apple system libraries; a set of Swift "Corelib" implementations replace them. These include a "swift-corelibs-foundation" to stand in for theFoundation Kit, a "swift-corelibs-libdispatch" to stand in for the Grand Central Dispatch, and an "swift-corelibs-xctest" to stand in for the XCTest APIs fromXcode.[104]

As of 2019, with Xcode 11, Apple has also added a major new UI paradigm called SwiftUI. SwiftUI replaces the olderInterface Builder paradigm with a new declarative development paradigm.[105]

Memory management

[edit]

Swift usesAutomatic Reference Counting (ARC) tomanage memory. Every instance of a class or closure maintains a reference count which keeps a running tally of the number of references the program is holding on to. When this count reaches 0 the instance is deallocated. This automatic deallocation removes the need for a garbage collector as instances are deallocated as soon as they are no longer needed.

Astrong reference cycle can occur if two instances each strongly reference each other (e.g. A references B, B references A). Since neither instances reference count can ever reach zero neither is ever deallocated, resulting in amemory leak. Swift provides the keywordsweak andunowned to prevent strong reference cycles. These keywords allow an instance to be referenced without incrementing its reference count.weak references must be optional variables, since they can change and becomenil.[106] Attempting to access anunowned value that has already been deallocated results in a runtime error.

A closure within a class can also create a strong reference cycle by capturing self references. Self references to be treated as weak or unowned can be indicated using acapture list.

classPerson{letname:Stringweakvarhome:Home?// Defined as a weak reference in order to break the reference cycle. weak references do not increment the reference count of the instance that they refer to.init(name:String){self.name=name}deinit{print("De-initialized\(name)")}}classHome{letaddress:Stringvarowner:Person?init(address:String,owner:Person?){self.address=addressself.owner=owner}deinit{print("De-initialized\(address)")}}varstacy:Person?=Person(name:"Stacy")varhouse21b:Home?=Home(address:"21b Baker Street",owner:stacy)stacy?.home=house21b// stacy and house42b now refer to each other.stacy=nil// The reference count for stacy is now 1, because house21b is still holding a reference to it.house21b=nil// house21b's reference count drops to 0, which in turn drops stacy's count to 0 because house21b was the last instance holding a strong reference to stacy.// Prints:// De-initialized 21b Baker Street// De-initialized Stacy

Debugging

[edit]

A key element of the Swift system is its ability to be cleanly debugged and run within the development environment, using aread–eval–print loop (REPL), giving it interactive properties more in common with the scripting abilities of Python than traditionalsystem programming languages. The REPL is further enhanced withplaygrounds, interactive views running within the Xcode environment orPlaygrounds app that respond to code or debugger changes on-the-fly.[107] Playgrounds allow programmers to add in Swift code along with markdown documentation. Programmers can step through code and add breakpoints usingLLDB either in a console or anIDE like Xcode.

Comparisons to other languages

[edit]

Swift is considered aC family programming language and is similar to C in various ways:

  • Most operators in C also appear in Swift, although some operators such as+ have slightly different behavior. For example, in Swift,+ traps on overflow, whereas&+ is used to denote the C-like behavior of wrapping on overflow.
  • Curly braces are used to group statements.
  • Variables are assigned using anequals sign, but compared usingtwo consecutive equals signs. A new identity operator,===, is provided to check if two data elements refer to the sameobject.
  • Control statementswhile,if, andswitch are similar, but have extended functions, e.g., aswitch that takes non-integer cases,while andif supportingpattern matching and conditionally unwrapping optionals,for uses theforiin1...10 syntax.
  • Square brackets are used witharrays, both to declare them and to get a value at a given index in one of them.

It also has similarities to Objective-C:

  • Basic numeric types:Int, UInt, Float, Double
  • Class methods are inherited, like instance methods;self in class methods is the class the method was called on.
  • Similarfor...in enumeration syntax.

Differences from Objective-C include:

  • Statements need not end with semicolons (;), though these must be used to allow more than one statement on one line.
  • No header files.
  • Usestype inference.
  • Generic programming.
  • Functions arefirst-class objects.
  • Enumeration cases can have associated data (algebraic data types).
  • Operators can be redefined for classes (operator overloading), and new operators can be defined.
  • Strings fully supportUnicode. Most Unicode characters can be used in either identifiers or operators.
  • Noexception handling. Swift 2 introduces a different and incompatible error-handling model.[108]
  • Several features of earlierC-family languages that are easy to misuse have been removed:
    • Pointers are not exposed by default. There is no need for the programmer to keep track of and mark names for referencing or dereferencing.
    • Assignments return no value. This prevents the common error of writingi = 0 instead ofi == 0 (which throws a compile-time error).
    • No need to usebreak statements inswitch blocks. Individual cases do not fall through to the next case unless thefallthrough statement is used.
    • Variables and constants are always initialized and array bounds are always checked.
    • Integer overflows, which result inundefined behavior for signed integers in C, are trapped as a run-time error in Swift. Programmers can choose to allow overflows by using the special arithmetical operators&+,&-,&*,&/ and&%. The propertiesmin andmax are defined in Swift for all integer types and can be used to safely check for potential overflows, versus relying on constants defined for each type in external libraries.
    • The one-statement form ofif andwhile, which allows for the omission of braces around the statement, is unsupported.
    • C-style enumerationfor (int i = 0; i < c; i++), which is prone tooff-by-one errors, is unsupported (from Swift 3 onward).[109]
    • The pre- and post-increment and decrement operators (i++,--i ...) are unsupported (from Swift 3 onward), more so since C-stylefor statements are also unsupported from Swift 3 onward.[110]

Development and other implementations

[edit]

Because Swift can run on Linux, it is sometimes also used as a server-side language.[111] Some web frameworks have been developed, such asIBM'sKitura (now discontinued),Perfect,Vapor, andHummingbird.

An official "Server APIs" work group has also been started by Apple,[112] with members of the Swift developer community playing a central role.[113]

A second free implementation of Swift that targetsCocoa,Microsoft'sCommon Language Infrastructure (.NET Framework, now.NET), and theJava andAndroid platform exists as part of theElements Compiler fromRemObjects Software.[114]

Subsets of Swift have beenported to additional platforms, such asArduino[115] andMac OS 9.[116]

See also

[edit]

References

[edit]
  1. ^U.S. patent no. 9329844
  2. ^"Swift Has Reached 1.0". Apple. September 9, 2014. RetrievedMarch 8, 2015.
  3. ^"Release 6.2.1". November 4, 2025. RetrievedNovember 6, 2025.
  4. ^"Swift, Objectively".Dr. Dobb's.Swift is proprietary and closed: It is entirely controlled by Apple and there is no open source implementation.
  5. ^Lattner, Chris (June 11, 2014)."Re: [LLVMdev] [cfe-dev] [Advertisement] open positions in Apple's Swift compiler team". Archived fromthe original on July 14, 2014. RetrievedJune 12, 2014.You can imagine that many of us want it to be open source and part of LLVM, but the discussion hasn't happened yet, and won't for some time.
  6. ^"Chris Lattner's Homepage". Chris Lattner. June 3, 2014. RetrievedJune 3, 2014.The Swift language is the product of tireless effort from a team of language experts, documentation gurus, compiler optimization ninjas, and an incredibly important internal dogfooding group who provided feedback to help refine and battle-test ideas. Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.
  7. ^abLattner, Chris (June 3, 2014)."Chris Lattner's Homepage". Chris Lattner. RetrievedJune 3, 2014.I started work on the Swift Programming Language in July of 2010. I implemented much of the basic language structure, with only a few people knowing of its existence. A few other (amazing) people started contributing in earnest late in 2011, and it became a major focus for the Apple Developer Tools group in July 2013 [...] drawing ideas fromObjective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.
  8. ^"Building assert() in Swift, Part 2: __FILE__ and __LINE__". RetrievedSeptember 25, 2014.
  9. ^"Influences - The Rust Reference".doc.rust-lang.org. RetrievedMay 2, 2020.
  10. ^"influenced by - V documentation".github.com. RetrievedNovember 3, 2023.
  11. ^"Mojo language FAQ".modular.com. RetrievedAugust 17, 2025.
  12. ^"Carbon Language GitHub".github.com. RetrievedAugust 17, 2025.
  13. ^Lardinois, Frederic (June 2, 2014)."Apple Launches Swift, A New Programming Language For Writing iOS And OS X Apps".TechCrunch. RetrievedSeptember 7, 2022.
  14. ^Protocol-oriented Programming in Swift.Apple Inc.YouTube. Archived fromthe original on July 16, 2023. RetrievedJune 18, 2015.
  15. ^"Concepts are similar to Rust Traits, (I think) Swift Protocols and Haskel Type C... | Hacker News".news.ycombinator.com.
  16. ^Williams, Owen (June 2, 2014)."Tim Berners-Lee's sixtieth birthday Apple announces Swift, a new programming language for iOS".The Next Web. RetrievedJune 2, 2014.
  17. ^"Apple's new programming language Swift is now open source".The Verge. December 3, 2015. RetrievedDecember 5, 2015.
  18. ^"Apple Open Sources Swift in Latest Pitch to the Enterprise". CIO Journal.The Wall Street Journal Blogs. December 3, 2015. RetrievedDecember 5, 2015.
  19. ^abPlatforms State of the Union, Session 102,Apple Worldwide Developers Conference, June 2, 2014
  20. ^The Swift Programming Language.Apple. June 2, 2014. RetrievedJune 2, 2014.
  21. ^"Swift Has Reached 1.0". September 9, 2014. RetrievedSeptember 10, 2014.
  22. ^"Xcode 6.1 Release Notes". October 22, 2014. RetrievedJanuary 23, 2015.
  23. ^"Xcode 6.3 Release Notes". April 8, 2015. RetrievedApril 8, 2015.
  24. ^"Swift 2 Apps in the App Store".Swift Blog. RetrievedMarch 13, 2016.
  25. ^"Swift 3.0 Released!".Swift.org. September 13, 2016. Archived fromthe original on October 14, 2016. RetrievedOctober 26, 2016.
  26. ^"Looking back on Swift 3 and ahead to Swift 4".Swift Forums. July 29, 2016. RetrievedNovember 19, 2018.
  27. ^"Swift-Evolution".Swift Evolution. RetrievedNovember 19, 2018.
  28. ^"Swift 4.0 Released!".Swift.org. September 17, 2017. Archived fromthe original on March 28, 2019. RetrievedMarch 1, 2018.
  29. ^"Swift 4.1 Released!".Swift.org. March 29, 2018. Archived fromthe original on April 25, 2019. RetrievedMarch 30, 2018.
  30. ^"The RedMonk Programming Language Rankings: January 2018 – tecosystems".redmonk.com. March 7, 2018. RetrievedNovember 20, 2018.
  31. ^Kremenek, Ted (March 25, 2019)."Swift 5 Released!".
  32. ^Kremenek, Ted (September 20, 2019)."Swift 5.1 Released!". Archived fromthe original on February 26, 2022. RetrievedOctober 28, 2019.
  33. ^Hudson, Paul (June 6, 2021)."What's new in Swift 5.5?".HackingWithSwift.com. Hacking with Swift. RetrievedJune 8, 2021.
  34. ^"Swift 5.9 Released".Swift.org. September 18, 2023. RetrievedOctober 9, 2023.
  35. ^Borla, Holly (September 17, 2024)."Announcing Swift 6".Swift.org. RetrievedOctober 15, 2024.
  36. ^Borla, Holly (March 31, 2025)."Swift 6.1 Released 6.1".swift.org. RetrievedApril 29, 2025.
  37. ^"Stack Overflow Developer Survey 2015".Stack Overflow.
  38. ^"Stack Overflow Developer Survey 2016 Results".Stack Overflow.
  39. ^"Swift.org and Open Source".Swift.org. Apple Inc. RetrievedFebruary 25, 2019.
  40. ^"Introducing the IBM Swift Sandbox — Swift".Swift. RetrievedDecember 5, 2015.
  41. ^Mayo, Benjamin (December 4, 2015)."Write Swift code in a web browser with the IBM Swift Sandbox".9to5Mac. RetrievedDecember 5, 2015.
  42. ^"After Apple open sources it, IBM puts Swift programming in the cloud".ZDNet. RetrievedDecember 5, 2015.
  43. ^"Swift Package Catalog and Swift Sandbox Deprecation". RetrievedNovember 9, 2018.
  44. ^"Swift Playgrounds".Apple Developer. RetrievedJune 19, 2016.
  45. ^"Swift Playgrounds — Preview".Apple. RetrievedJune 19, 2016.
  46. ^Mayo, Benjamin (June 13, 2016)."Apple announces Swift Playgrounds for iPad at WWDC, public release in fall".9to5Mac. RetrievedJune 19, 2016.
  47. ^Cunningham, Andrew (January 10, 2017)."Longtime Apple programmer and Swift creator leaves Apple for Tesla". Ars Technica.
  48. ^Wuerthele, Mike (January 13, 2017)."New Swift project head Ted Kremenek said to be running the show behind the scenes for some time". AppleInsider.
  49. ^Daniel Eran Dilger (June 19, 2019)."WWDC19: SwiftUI was the brightest star in a galaxy of new ideas".AppleInsider. RetrievedJuly 19, 2019.
  50. ^"Swift.org - Download Swift". RetrievedJune 21, 2020.
  51. ^"Android SDKs for Swift".GitHub. RetrievedSeptember 10, 2021.
  52. ^"swift-lang package versions". RetrievedSeptember 10, 2021.
  53. ^"Announcing the Swift SDK for Android".Swift.org. October 24, 2025.
  54. ^Readdle (January 15, 2020)."Swift for Android: Our Experience and Tools".Medium. RetrievedAugust 20, 2020.
  55. ^Anderson, Tim (March 30, 2020)."Official tailored Swift for Windows support promised in 5.3: Swift on more platforms – provided you do not need a GUI".The Register. RetrievedSeptember 18, 2020.
  56. ^"The Swift Linux Port".Swift.org. Apple Inc. December 3, 2015. RetrievedAugust 3, 2016.
  57. ^Timmer, John (June 5, 2014)."A fast look at Swift, Apple's new programming language".Ars Technica.Condé Nast. RetrievedJune 6, 2014.
  58. ^Kremenek, Ted (March 25, 2019)."Swift 5 Released!".Swift.org. RetrievedMarch 28, 2019.
  59. ^"Download Swift".Swift.org. Apple. RetrievedDecember 15, 2020.
  60. ^Kremenek, Ted (April 26, 2021)."Swift 5.4 Released!".Swift.org. Apple. Archived fromthe original on April 26, 2021. RetrievedApril 26, 2021.
  61. ^Kremenek, Ted (March 14, 2022)."Swift 5.6 Released!".Swift.org. Apple. RetrievedMarch 14, 2022.
  62. ^"Release Swift 5.6.1 Release · apple/Swift".GitHub.
  63. ^"Release Swift 5.6.2 Release · apple/Swift".GitHub.
  64. ^"Release Swift 5.6.3 Release · apple/Swift".GitHub.
  65. ^Borla, Holly (September 12, 2022)."Swift 5.7 Released!".Swift.org. Apple. RetrievedSeptember 23, 2022.
  66. ^"Release Swift 5.7.1 Release · apple/Swift".GitHub.
  67. ^"Release Swift 5.8 Release · apple/Swift".GitHub.
  68. ^"Release Swift 5.8.1 Release · apple/swift".GitHub. RetrievedJune 14, 2023.
  69. ^"Release Swift 5.9 Release · apple/swift".GitHub. RetrievedSeptember 18, 2023.
  70. ^"Release Swift 5.9.1 Release · apple/swift".GitHub. RetrievedOctober 19, 2023.
  71. ^"Release Swift 5.9.2 Release · apple/swift".GitHub. RetrievedDecember 11, 2023.
  72. ^Borla, Holly (March 5, 2024)."Swift 5.10 Released".Swift.org. RetrievedMarch 13, 2024.
  73. ^"Swift 5.10.1 Release".GitHub. RetrievedJune 5, 2024.
  74. ^"Swift 6.0 Release".GitHub. RetrievedSeptember 17, 2024.
  75. ^"Swift 6.1 Release".GitHub. RetrievedApril 29, 2025.
  76. ^"Swift 6.2 Release".GitHub. RetrievedSeptember 17, 2025.
  77. ^"Documentation".docs.swift.org. RetrievedNovember 17, 2023.
  78. ^"Eliminate data races using Swift Concurrency - WWDC22 - Videos". Apple Inc. RetrievedNovember 17, 2023.
  79. ^ab"Documentation".docs.swift.org. RetrievedOctober 15, 2023.
  80. ^"Documentation".docs.swift.org. RetrievedOctober 15, 2023.
  81. ^"Closures — The Swift Programming Language (Swift 5.5)".docs.swift.org. RetrievedAugust 31, 2021.
  82. ^Macomber, Kyle; Yaskevich, Yavel; Gregor, Doug; McCall, John."Multiple Trailing Closures".GitHub. RetrievedOctober 19, 2020.
  83. ^"Documentation".docs.swift.org. RetrievedOctober 16, 2023.
  84. ^"Strings and Characters".docs.swift.org. RetrievedOctober 16, 2023.
  85. ^"Declarations — The Swift Programming Language (Swift 5.6)".docs.swift.org. RetrievedFebruary 28, 2022.
  86. ^"Access Control".The Swift Programming Language.Apple Developer. RetrievedOctober 25, 2016.
  87. ^"Nullable Types", C# Programming Guide, Microsoft.Archived February 21, 2017, at theWayback Machine.
  88. ^"Types".The Swift Programming Language.Apple Developer. RetrievedJuly 16, 2014.
  89. ^ab"Classes and Structures".The Swift Programming Language. Apple Developer.Archived from the original on March 25, 2016.
  90. ^Guhit, Fiel (February 14, 2015)."Performance Case Study on Swift 1.1, Swift 1.2, and Objective-C".Medium.Archived from the original on December 12, 2023.
  91. ^Building Better Apps with Value Types. Apple. Archived fromthe original on June 21, 2015.
  92. ^"Extensions".docs.swift.org. RetrievedNovember 28, 2023.
  93. ^"Working with Protocols".Programming with Objective-C. Apple Developer Documentation Archive. September 17, 2014.Archived from the original on April 29, 2016.
  94. ^"NSCopying Protocol Reference".Apple.
  95. ^"Swift standard library statistics".swiftinit.org. Swiftinit. RetrievedOctober 2, 2023.
  96. ^Thompson, Mattt (September 2, 2014)."Swift Default Protocol Implementations".NSHipster.
  97. ^"swift-evolution/proposals/0304-structured-concurrency.md at main · apple/swift-evolution".GitHub. RetrievedOctober 16, 2023.
  98. ^"swift-evolution/proposals/0296-async-await.md at main · apple/swift-evolution".GitHub. RetrievedOctober 16, 2023.
  99. ^"Do Swift-based apps work on macOS 10.9/iOS 7 and lower?", StackOverflow
  100. ^Sandberg, Alexander; Boria, Holly (September 18, 2023)."Swift 5.9 Released".Swift.org. Apple. RetrievedOctober 9, 2023.
  101. ^"Writing Swift Classes with Objective-C Behavior", Apple Inc.
  102. ^"Migrating Your Objective-C Code to Swift".Apple Developer Documentation.
  103. ^"Swift and Objective-C in the Same Project", Apple Inc.
  104. ^"Apple: search "corelib"".GitHub.
  105. ^"Xcode - SwiftUI- Apple Developer".developer.apple.com. RetrievedFebruary 1, 2021.
  106. ^Lanier, Brian; Groff, Joe."Intermediate Swift". Apple. RetrievedJuly 3, 2014.
  107. ^Metz, Cade."Why Coders Are Going Nuts Over Apple's New Programming Language".Wired. RetrievedJuly 16, 2014.
  108. ^"Error-Handling in Swift-Language".stackoverflow.com.
  109. ^"apple/swift-evolution".GitHub. RetrievedApril 4, 2016.
  110. ^"apple/swift-evolution".GitHub. RetrievedApril 4, 2016.
  111. ^Barbosa, Greg (February 22, 2016)."IBM brings Swift to the cloud, releases web framework Kitura written in Apple's programming language".9to5Mac. RetrievedMay 16, 2016.
  112. ^"Server APIs Work Group".Swift.org. October 25, 2016. RetrievedOctober 28, 2016.
  113. ^"Swift.org".Swift.org. Archived fromthe original on May 10, 2021. RetrievedOctober 28, 2016.
  114. ^"RemObjects Elements Compiler". RetrievedJanuary 17, 2016.
  115. ^"Swift for Arduino".
  116. ^Rose, Jordan (April 1, 2020)."Swift on Mac OS 9".-dealloc.

External links

[edit]
Frameworks and libraries
Integrated development environments
Text editors
Build tools and package managers
Compilers and runtimes
Debugging and profiling tools
See also
External
Software byApple
Operating
systems
Consumer
Professional
Education
Bundled
Server
Developer
Internet
onWindows
International
National
Other
Retrieved from "https://en.wikipedia.org/w/index.php?title=Swift_(programming_language)&oldid=1323655666"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp