Get the Lowest Prices anywhere on Macs, iPads and Apple Watches: Apple Price Guides updated April 5th
 


Chris Lattner, Apple's former Senior Director of Developer Tools, began developing Swift in July of 2010. Lattner and a team of developers based Swift off of Objective-C,  Ruby, Python, and many other coding languages. 

In June of 2014, a beta version of Swift was released to registered Apple developers, and in October of 2014, Swift 1.1 was released alongside the launch of Xcode 6.1. 

In late December 2015, Swift and its libraries, package manager, and debugger were released for public use as open-source software. Since then, Swift has been publicly available and anyone who wishes to contribute to the development may do so.

In 2019, Apple announced SwiftUI, a feature within Xcode that gives users a framework for declarative user interface design across all Apple platforms.

Swift's current version is version 5.1 on both Linux and Apple-based platforms.

Notable features of Swift

The most noteworthy feature of Swift is its similarity to Objective-C. Swift uses the Objective-C runtime library, which will allow C, Objective-C, C++, and Swift code to run within a single program. 

Swift is capable of writing programs for macOS, iOS, iPadOS, watchOS, tvOS, as well as Linux. Because Swift is open-source, it's plausible that Swift could be incorporated into other platforms as well, including web design.

Swift is designed to work with Apple's Cocoa and Cocoa Touch frameworks-- the API required to make applications work with macOS and Apple's mobile platforms such as the iPhone.

Like Objective-C, Swift supports dynamic dispatch, widespread late binding, extensible programming, and more. 

Safety and bug catching

One of Apple's priorities when designing Swift was to create a "safer" code. Swift has been equipped with features and tools to address common programming errors. 

Unlike Objective-C, Swift doesn't expose pointers or any accessors that would lead to software vulnerabilities or possible bugs later down the line. 

Swift initializes variables before use, checks integers and arrays for overflow, and automatically manages memory. Swift also enforces exclusive access to memory, guarding against a plethora of common programming mistakes. 

Swift's use of optional values enable users to avoid run-time crashes Swift's use of optional values enable users to avoid run-time crashes

Swift is written to be read and understood at a glance, which helps users easily locate problems if one should arise. Additionally, it limits the need for nested indentation that can lead to difficulty reading code-- a common problem often referred to as the pyramid of doom. 

Swift also supports protocol extensibility,  a system that can be applied to types, structs, and classes. This protocol-oriented programming allows for safer -- and saner -- implementation of abilities and features to code. 

Ease of use

While based on Objective-C, Swift was designed to be easier to use. It employs modern programming-language theory and simpler syntax, making it both easier to write and read.

Swift also requires less code to complete the same task as Objective-C and is often praised for being beginner-friendly.  

Speed 

Hence the name, Swift is designed to be lightweight and fast. It complies data much faster than Objective-C. In Objective C, classes are treated as objects, which results in slower code. Swift rewrites arrays as structures, which allows the code to function much quicker than its Objective-C counterpart.

In a similar vein, Swift also consumes less memory than Objective-C. Objective-C requires RAM in the event that code features an object-link.  Swift, on the other hand, utilizes structures. This has reduced the amount of reference-type data and SDK classes, which consequently has resulted in more efficient memory usage.

According to Apple, by using Swift, a common search algorithm completes 2.6 times faster than Objective-C, and up to 8.4 times faster than Python 2.7. 

Open Source

Since December of 2015, Swift has been open source and available to anyone who wishes to use it. It's licensed under the Apache 2.0 open source license and is generally targeted toward developers, educators, and students. Apple has said that by making Swift open source, they hope it would become one of the core programming languages of the next 20 years.  

“By making Swift open source the entire developer community can contribute to the programming language and help bring it to even more platforms,” said Craig Federighi, Apple’s senior vice president of Software Engineering, in a press release. “Swift’s power and ease of use will inspire a new generation to get into coding, and with today’s announcement they’ll be able to take their ideas anywhere, from mobile devices to the cloud.”

Apple encourages those interested in learning about or contributing to Swift to visit Swift.org. Swift.org is Apple's jumping-off point for those interested in learning about Swift, as well as a community hub where users can ask questions and contribute to the active development of Swift.

Those who head to Swift's GitHub page can find the Swift compiler, debugger, standard library, foundation libraries, package manager, and REPL. 

Learning Swift

The Swift Programming Language

Alongside its beta launch in 2014, Apple released The Swift Programming Language, a 500-page manual that can be downloaded free from iBooks. 

The Swift Programming Language serves as both a guide and a reference material that coders and programmers can reference back to as needed. 

The book starts out with a twenty-page introduction that sets up the basics of the language, which is often enough for experienced programmers coming from another code like Ruby or C++. 

The rest of the book shows how one would actively develop an app, starting simple with a print "Hello World" script, and building on more complex themes as it introduces new points.

Swift Playgrounds

Swift Playgrounds on iPad, showing a user how to code a 'for loop' Swift Playgrounds on iPad, showing a user how to code a 'for loop'

Swift Playgrounds is an iPad app developed by Apple that is designed to make learning to code Swift easy for anyone. Apple suggests anyone eight or older could benefit from using Swift Playgrounds, and the interactive environment encourages experimentation.

Additionally, a version of Swift Playgrounds exists within Xcode, where users can quickly mock up ideas for programs, apps, and user interfaces without needing to create a complete product. This lends itself well to troubleshooting, prototyping, and experimentation, and many professionals have cited that it makes for faster development.

Swift Playgrounds is free, and those interested can learn more about it here.

Essential Reading