Swift is a new programming language by Apple Inc. It is for devices like iPhone, iPad and Mac. Swift is an innovative programming language designed for Cocoa and Cocoa Touch. Writing code is interactive, easy and fun, the syntax is concise yet expressive, and apps run blazing fast. Swift is ready for iOS 8 and next OS X project. Swift code works side-by-side with Objective-C.
Swift is the outcome of the deep research on programming languages, plus decades of experience creating Apple platforms. Named parameters brought forward from Objective-C are expressed in a clean syntax that makes APIs in Swift easy to read and maintain.
Inferred types make code clean and less prone to mistakes, while modules eliminate headers and provide namespaces. Memory is managed automatically, and you don’t even need to type semi-colons.
Swift has many unique features to make your code more expressive:
Closures unified with function pointers
Tuples and multiple return values
Fast and concise iteration over a range or collection
Structs that support extensions, methods, protocols.
Functional programming patterns
Playgrounds make writing Swift code incredibly easy and joy. Write a line of code and the result appears quickly. If your code runs over time, you can watch its progress in the timeline assistant. The timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene. When you’ve perfected your code in the playground, easily move that code into project. Some uses for playgrounds include:
Design a new algorithm, watching its results every step of the way
Build new tests, verifying they work before promoting into your test suite
Experiment with new APIs to hone your Swift coding skills
The debugging console in Xcode includes an interactive version of the Swift language built right in. Use Swift syntax to evaluate and interact with your running app, or write new code to see how it works in a script-like environment. Available from within the Xcode console, or in Terminal.
Designed for Safety
Swift removes entire classes of unsafe code. Variables are always initialized before use, arrays and integers are checked for overflow, and memory is managed automatically. Syntax is tuned to make it easy to define your intent . Simple three character keywords define a variable (var) or constant (let).
The safe patterns in Swift are tuned for the powerful Cocoa and Cocoa Touch APIs. Understanding and properly handling cases where objects are nil is fundamental to the frameworks, and Swift code makes this very simple. Adding a single character can replace what used to be an entire line of code in Objective-C. This all works together to make creating iOS and Mac apps easy and safer than before.
Fast and Powerful
Swift is built to be fast. Using the incredibly high-performance LLVM compiler, Swift code is transformed into optimized native code, tuned to get the most out of modern Mac, iPhone, and iPad hardware. The syntax and standard library made to make perfect way to write your code also perform accurately.
Swift is a successor to the C and Objective-C languages. It includes low-level primitives such as types, flow control, and operators. It also offers object-oriented features such as classes, protocols, and generics, giving Cocoa and Cocoa Touch developers the performance and power they demand.