Course info
Oct 7, 2014
3h 5m

After over two decades of dominance, Objective-C is being replaced by a new upstart: Swift. Swift promises to be a new language that synthesizes the best ideas from several other popular languages. It also has its own unique twists on programming. Swift's terse and expressive syntax, along with an amazing dynamic exploration tool make Swift a must-learn language for Mac and iOS developers. Note: This course covers the version 1.0 specification of the language, but should be compatible with the current language syntax.

About the author
About the author

Alex has been in software development for over fifteen years. He's worked on a wide variety of systems and languages including web frameworks, databases and networking applications. Since the original iOS SDK was released in 2007 he has focused on iOS development.

More from the author
HTTP Networking in iOS
4h 11m
Jul 24, 2014
Meet MacRuby
1h 14m
May 19, 2009
Section Introduction Transcripts
Section Introduction Transcripts

Object-Oriented Programming in Swift
In this module we're going to dive deeper in to Swifts Object-Oriented Programming Model. Let's review what we know so far about objects and classes in Swift, now from the last module we know that Swift classes support a single inheritance model, and that polymorphism can be achieved by adopting multiple protocols, methods can be defined at the class and the object instance levels, properties can also be defined at both the class and the object level, additional behavior can be added to existing classes through extensions, and we know that object instances are reference types. Now when we declare class in Objective-C we use the @interface keyword followed by the name of the class, and then that's followed by a colon and the name of the subclass, and then any protocols that the class conforms to are listed inside of the angle brackets, followed by instance, variables, properties, and the methods of the class. In Swift we declare a class with the class keyword followed by the class name, and to subclass a class you add a colon followed by the subclass name, and then any protocols the class conforms to go after that, the rule is that the subclass comes first in the list after the colon. Now unlike Objective-C, Swift classes aren't required to subclass a root class, so if your class only declares protocol support you can simply list the protocols right after the colon. Swifts object model works pretty much like Objective-C, but if you're new to the Apple platform you'll find that Swifts object oriented programming model shares a lot in common with popular languages like C# and Java. Now in the next video we'll start at the beginning, creating and initializing new object instances.

The Swift Standard Library
In this module we're going to look at the Swift Standard Library, what may surprise you is just how small it really is. Swift only exposes a handful of data types in its standard library, and throughout this course you've already seen most of these. There are only three publically documented protocols available in Swift. And Swift only provides just a handful of global functions. Now form the looks of this it would appear that Swift doesn't offer much capability, but remember Swift secret weapon is its ability to leverage all of Apples existing APIs, and given that there isn't much that the Swift Standard Library really needs to offer, so let's start by looking at Swifts core types.