Swift Tutorial

Swift 教程

Swift is an open-source programming language that supports multiple programming paradigms and compilation. Apple released it at WWDC 2014 (Apple Developers Conference) for developing iOS, OS X, and watchOS applications.

Swift combines the advantages of C and Objective-C and is not limited by C compatibility.

Swift can use the same runtime environment as Objective-C on Mac OS and iOS platforms.

On June 8, 2015, Apple announced at WWDC 2015 that Swift would be open source, including the compiler and standard library.


Who is this tutorial for?

This tutorial is suitable for programmers who want to work on mobile (iPhone) development or OS X applications. It is even better if you have some programming background.

All examples in this tutorial are developed and tested based on Xcode 8.2.1 (Swift 3.0.2 syntax format).


First Swift Program

The first Swift program naturally starts with printing "Hello, World!", as shown in the following code:

Example

/*My first Swift program*/ var myString = "Hello, World!" print(myString)

Run Example »

Example Analysis

  • 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


Related Resources

Other Extensions