Swift Tutorial
Swift is an open-source, compiled programming language supporting multiple programming paradigms. It was released by Apple at WWDC 2014 (Apple Developers Conference) and is used to develop iOS, OS X, and watchOS applications.
Swift combines the strengths of C and Objective-C without being constrained by C compatibility.
Swift is a general-purpose programming language released by Apple in 2014, mainly used to develop apps for iOS, iPadOS, macOS, watchOS, and tvOS.
On the Mac OS and iOS platforms, Swift can use the same runtime environment as Object-C.
Swift is a general-purpose programming language released by Apple in 2014, mainly used to develop apps for iOS, iPadOS, macOS, watchOS, and tvOS.
Who should read this tutorial?
This tutorial is intended for programmers who want to develop mobile (iPhone) apps or OS X applications; prior programming experience is a plus.
All examples in this tutorial were developed and tested with Xcode 8.2.1 (using Swift 3.0.2 syntax).
Your First Swift Program
The first Swift program naturally starts by printing "Hello, World!", as shown below:
Example
/*
My First Swift Program
*/
var
myString
=
"
Hello, World!
"
(
myString
)
Run Example »
Example Parsing
-
var myString = "Hello, World!" : Use the var keyword to define a variable myString with the value Hello, World!
-
print : Print the value of the variable
Reference Links
| Resource | Address | Description |
|---|---|---|
| The Swift Programming Language | docs.swift.org/swift-book | Official Apple language guide, TSPL |
| Swift.org | www.swift.org | Open-source project homepage, toolchain downloads, and blog |
| Swift Evolution | swift.org/swift-evolution | Language proposals, authoritative references bearing SE numbers |
| Swift Standard Library documentation | developer.apple.com/documentation/swift | Standard Library API reference |
Note when reading proposals: only those with an SE-xxxx number are official Swift Evolution proposals; other repository documents cannot serve as a basis for version facts.
<