Mastering Swift 2 Programming
4.0 (40 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
156 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Mastering Swift 2 Programming to your Wishlist.

Add to Wishlist

Mastering Swift 2 Programming

An in-depth course on advanced Swift programming and writing highly performant, elegant, and readable code
4.0 (40 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
156 students enrolled
Created by Packt Publishing
Last updated 5/2016
Curiosity Sale
Current price: $10 Original price: $95 Discount: 89% off
30-Day Money-Back Guarantee
  • 5 hours on-demand video
  • 1 Supplemental Resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Gain useful insight into your code’s memory performance by analyzing your application with powerful Xcode tools
  • Utilize the CocoaPods package manager to import third-party Swift libraries into your project
  • Employ bridging headers to interoperate with other languages such as Objective-C, C, and C++ code
  • Write concurrent applications by utilizing asynchronous functions and powerful multi-threading features such as Grand Central Dispatch
  • Improve your development speed by gaining advanced debugging skills
  • Write safer code by seeing how to throw, catch, and handle exceptions
  • Choose the best algorithm for your application by comparing performance metrics in XCTest
  • Take a look at several design patterns that address common problems programmers face in Swift
View Curriculum
  • You need to be well acquainted with the core development environments and frameworks and capable of building applications.

Swift 2 is a multi-paradigm programming language that has expressive features familiar to modern functional languages, and does not forget the object-oriented features of Objective-C. Things that took a block of code in Objective-C are reduced to one or two lines in Swift. Swift is said to be safer, faster, and easier to understand, and has the energy of Apple and the open source community behind it.

This course takes you on a journey through a wide array of topics that are crucial to writing top-level Swift code. You will get an in-depth view of various core topics such as advanced language features, memory management, interoperability, concurrency, advanced debugging, algorithms, and performance optimizations. Last but not least, we’ll also explore Swift design patterns.

We’ll start by discussing the uniqueness of Swift, what’s new, and what’s to come. Then we take a look at fast-paced deconstructions of advanced language features such as extensions, generics, protocols, and more. Next we’ll focus on memory management as you learn how to measure and address our applications’ memory usage.

Soon we’ll dive into opening Swift up to Objective-C, C, and even C++ code and speeding up development by leveraging third-party frameworks. We will then move on to asynchronous programming and concurrency and you’ll see how to process multiple tasks simultaneously.

You’ll discover how to debug your applications more effectively, which is one of the key components to becoming a faster developer. As the journey comes to an end, we will take a look at compiler optimizations, performance measurements, and algorithms and complexity. Finally, you’ll explore specific design patterns can address common programming problems.

About The Author

Dan Beaulieu is a Swift, ASP.NET, and AngularJS application developer, who currently works for a company that specializes in customer management and training software. Dan started his career 10 years ago as a freelance web developer focused on e-commerce using ASP.NET.

He also holds a degree in Mobile Applications and Development with an emphasis on iOS. In his free time, he enjoys writing applications, blogging about programming, and hiking with his dog Herzog. He currently operates, a website featuring tutorials on both C# and Swift.

Who is the target audience?
  • If you are an intermediate Swift developer who is familiar with the language but wants to improve your knowledge, techniques, and efficiency with Swift, this course is for you.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
58 Lectures
Swift Primer and Introduction to Functional Programming
8 Lectures 42:13

This video gives an overview of the entire course.

Preview 04:03

We’ve all been exposed to Swift’s primitive types, though Swift also has some unique language characteristics that we should be aware of. 

Swift Review – Operators, Types, and Strings

We’ve all been exposed to Swift’s Collection Types as well, though Swift again has some unique language characteristics that we should be aware of. 

Swift Review – Collection Types

We’ve all been exposed to Swift’s Classes, Structs, and Enums. But yet again, Swift has some unique language characteristics that we should be aware of. 

Swift Review – Classes, Structs and Enums

In programming, we’re often faced with the need to execute a piece of code depending on a specific condition. In this video, we’ll look at the flow of control operations that gives us that ability. 

Swift Review – Flow of Control and Optionals

The Swift programming language is changing rapidly, and it’s often difficult to keep track of the new additions. In this video, we’ll look at Swift’s new additions to catch us up to speed. 

What’s New in Swift 2?

Swift is often referred to as a functional language, though most programmers have exploited only the object-oriented side of the language. 

Functional Programming

Most programmers are not familiar with the concept of protocol-oriented programming though it’s Apple’s preferred approach for Swift. 

Protocol Oriented Programming
Advanced Language Features and Functional Concepts
9 Lectures 48:08

This video exposes the user to Game of Life. Our application needs a starting point. In this video we’ll get our program up and running. 

Preview 09:16

We have an initializer that requires some looping to populate a grid. We’ll pull the logic away from the initializer and utilize a lazy variable. 

Function Value Types and Closure Syntax

Often we’ll find ourselves needing to extend a class' functionality. In this video, we’ll see how we can extend any class. 


We’ve extended the functionality of Array to filter for neighboring cells. But this implementation is rigid, so we’ll utilize generics to create a more flexible and useful filter. 


Writing complex code often requires that we laboriously plumb up boilerplate code to get to the higher functionality. We’ll introduce higher order functions that save us from this. 

Higher-order Functions – Filter

We’re looking for a way to create more succinct code that removes the noise of boilerplate code but maintains readability. For this, we’ll look at map. 

Higher-order Functions – Map

Often, we’ll run into multi-dimensional arrays or arrays with nil values in them. In this video, we’ll see how the higher order function flatMap can solve this problem. 

Higher-order Functions – FlatMap

Often, we'll utilize a for-in loop to accumulate a sequence of values. We'll look at a higher order replacement for this process. 

Higher-order Functions – Reduce

We’ve encountered SequenceTypes and GeneratorTypes a few times already, but we haven’t explained them. This video does just that. 

Sequences and Generators
Exploring Swift’s Memory Management
6 Lectures 30:34

Sometimes, it’s hard to understand why we face memory problems, which causes memory issues to go unresolved. We’ll explore how Swift does memory management with ARC. 

Preview 06:15

It’s difficult to know when you have a memory issue, let alone visualize general memory performance. In this video, we’ll learn to use instruments to visualize our memory allocations. 

Introduction to Instruments

Most new iOS developers are entirely unaware of Strong Reference Cycles. In this video, we’ll understand what they are and create one. 

Strong Reference Cycles

In the previous video, we created a memory leak. In this video, we’ll resolve this issue by introducing a weak reference. 

Fixing our Leak – Weak and Unowned References

While interoperating with C and Objective-C, it’s possible to create Zombies. In this video, we’ll create one so that we understand how they occur. 

Creating a Zombie

The things you don’t know about memory management can hurt you. In this video, we’ll uncover eight things to improve overall memory performance. 

8 Tips to Improve Memory Performance
Interoperability and Working with 3rd Party Libraries
7 Lectures 37:04

In order to work with other languages in Cocoa, we should be aware of how Swift and Objective-C interact. This video discusses implicit bridging in Swift. 

Preview 05:41

Often, iOS developers will be required to make their Swift code accessible to Objective-C. In this video, we’ll learn how we can accomplish this. 

Exposing Swift to Objective-C

A frequent task that Swift developers need to carry out is interfacing with legacy Objective-C projects and libraries. We’ll demonstrate how this is accomplished. 

Using Objective-C in Swift

When all else fails, C is often the tool developers reach out to, but how do we use it from Swift? We’ll learn how we can utilize C code in Swift. 

Interacting with C

C++ is a powerful low-level language that offers a lot of potential for Swift developers. Unfortunately, interoperability with C++ is not yet a language feature. There is a way to call C++ code from Swift though. 

Wrapping C++ for Using in Swift

As a developer, it makes sense to leverage open source frameworks and libraries to speed up productivity. We’ll learn how we can include third-party libraries. 

Working with CocoaPods

Open source libraries are abundant on GitHub and other repository hosts too, though it isn’t always obvious how to incorporate them into our projects. Here, we’ll see how to manually install a third-party Objective-C library in our application. 

Incorporating an Objective-C Library
Concurrency and Grand Central Dispatch
8 Lectures 37:53

Concurrency is a topic that introduces a lot of confusion to new programmers. We’ll clarify what it is and why we need to manage it. 

Preview 04:11

We’ll occasionally find ourselves in need of performing two operations simultaneously. In this video, we’ll demonstrate how to create our own threads to do just that. 

Threading with NSThread

In the last video, we demonstrated a race condition where our values were being mutated by other threads. In this video, we’ll utilize locking to protect our values. 

Locking Threads

We’ll frequently encounter situations where we need a block of code to wait for another operation to finish before executing. In this video, we’ll introduce completion handlers that run code only after operations are complete. 

Asynchronous Methods

Managing our own threads can be cumbersome and can become a great source for bugs. In this video, we’ll learn about NSOperationQueue, which abstracts away the whole notion of locking. 

Concurrency with NSOperationQueue

NSOperationQueue is nice, but it’s still a Cocoa class that requires instantiation. When performance is key, Grand Central Dispatch may be a better choice. In this video, we’ll learn about GCD. 

Grand Central Dispatch

‘dispatch_async’ attaches our closure to a type of dispatch queue. But how do we know which queue to use? In this video, we’ll look at the different types of queues available for us. 

Working with Dispatch Queues

There may be times when you want to wait to run a block of code while you carry out tasks on different threads. For this situation, we will look up to dispatch groups. 

Asynchronous Programming with Dispatch Groups
Troubleshooting, Advanced Debugging, and Error Handling
6 Lectures 30:29

The LLDB debugger offers quite a few tools to inspect our code; unfortunately, our code won’t inspect itself. In this video, we’ll learn about the different debugging tools we have at our fingertips. 

Preview 05:31

Sometimes, we need our breakpoints to fire only under certain conditions. In this video, we’ll see how to get the most from our breakpoints with breakpoint conditions, actions, and exceptions. 

Advanced Breakpoints

We’ve all seen the LLDBcommand prompt window in Xcode, but many new developers don’t know that they can execute commands in it. In this video, we’ll demonstrate some LLDB commands. 

The LLDB Command Language

Some errors are much harder to track down than others, such as memory buffer or stack overflow errors. In this video, we’ll demonstrate how to enable address sanitization, which will catch a myriad of memory problems. 

Address Sanitization

Sometimes, we need a sanity check while developing to make sure that a value really will exist. Swift provides a few assertions for this need. 


When things don’t work as expected in our applications, we need to know how to manage control of our user experience. In this video, we’ll demonstrate how we can gracefully capture exceptions. 

Error Handling
Performance Optimization and Introduction to Algorithms
7 Lectures 38:34

There are times when your application runs slow and you don’t know why. In this video, we’ll demonstrate two ways to test the performance of your code. 

Preview 06:42

Most new Swift developers don’t know that you can change the compiler optimization mode in Xcode to achieve better performance. In this video, we’ll learn how to change modes and measure the difference in performance. 

Whole Module Optimization

By default, all of our classes can be inherited from and overridden, but this is not optimal and we should limit this to improve performance. In this video, we’ll introduce the final keyword. 

Reducing Dynamic Dispatch

There are performance implications of using classes and structs. The problem is that it is often difficult to know the impact until you measure it. In this video, we’ll test the performance between structs and classes. 

Reference Types and Performance

When we write a generic method, we expect it to perform the same as its explicit type counterparts. This isn’t usually the case by default. In this video, we’ll demonstrate how to get your generic methods to perform like their non-generic counterparts. 

Generic Specialization

There are many ways to solve a programming problem. Some problems are more efficient than others, but it can be difficult to communicate these efficiencies. In this video, we’ll look at the big o notation, which is a way programmers communicate about the efficiency of computer programs. 

Choosing the Right Algorithm

You’ll sometimes find yourself with a function that performs the same computations over and over and at a great CPU expense. In this video, we’ll demonstrate an algorithm that allows you to cache computations for reuse to drastically improve performance. 

Design Patterns
7 Lectures 30:38

You’ll sometimes find yourself with a function that performs the same computations over and over and at a great CPU expense. In this video, we’ll demonstrate an algorithm that allows you to cache computations for reuse to drastically improve performance. 

Preview 02:58

There are times when we need just one instance of an object, and we need it to be available everywhere in our application. In this video, we’ll look at how the singleton pattern can help. 

Singleton Pattern

If you’ve got a project that has many similar objects floating around, then the factory pattern might be the solution. In this video, we’ll demonstrate how to implement the factory pattern to abstract instantiation away. 

Factory Pattern

A common problem that programmers face is how to make two incompatible APIs work together. We’ll introduce the adapter pattern, which does just that. 

Adapter Pattern

When we’re working with many similar classes, it can be cumbersome to deal with multiple interfaces for similar tasks. In this situation, we can look to the Façade Pattern to give us a unified interface. 

Façade Pattern

In some situations, it’s best to take a decoupled approach to sending requests by sending them down a chain of possible receivers until one can process the request. In this video, we’ll introduce the Chain of Responsibility Pattern, which does just that. 

Chain of Responsibility Pattern

There are times when you’ll need two decoupled code bases to speak to one another. In this video, we’ll demonstrate the Observer Pattern; it allows us to do just that. 

Observer Pattern
About the Instructor
Packt Publishing
3.9 Average rating
7,297 Reviews
52,303 Students
616 Courses
Tech Knowledge in Motion

Packt has been committed to developer learning since 2004. A lot has changed in software since then - but Packt has remained responsive to these changes, continuing to look forward at the trends and tools defining the way we work and live. And how to put them to work.

With an extensive library of content - more than 4000 books and video courses -Packt's mission is to help developers stay relevant in a rapidly changing world. From new web frameworks and programming languages, to cutting edge data analytics, and DevOps, Packt takes software professionals in every field to what's important to them now.

From skills that will help you to develop and future proof your career to immediate solutions to every day tech challenges, Packt is a go-to resource to make you a better, smarter developer.

Packt Udemy courses continue this tradition, bringing you comprehensive yet concise video courses straight from the experts.