Take this

Software Development / Web Development

Mastering Swift 2 Programming

An in-depth video course that covers advanced Swift programming and focuses on writing highly performant, elegant, and readable code


About This Video

  • Explore Swift's revolutionary leap from Objective-C, and leverage its higher-level features to get the most out of the Cocoa framework
  • Learn how to exploit compiler optimizations to attain blazing code performance
  • Gain a deeper understanding of your Swift code through dynamic and easy-to-follow demonstrations

In Detail

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.

Full details


  • Swift Primer and Introduction to Functional Programming
    The Course Overview
    This video gives an overview of the entire course.
    Swift Review – Operators, Types, and Strings
    We’ve all been exposed to Swift’s primitive types, though Swift also has some unique language characteristics that we should be aware of. • Review the major Swift operators, types, and string-type features • Highlight the unique characteristics of the Swift language • Set expectations and provide reference material
    Swift Review – Collection Types
    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. • Review the important Swift array, dictionary, and set features • Set expectations and provide reference material
    Swift Review – Classes, Structs and Enums
    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. • Review the important Swift Struct, Class, and Enum features • Highlight the unique characteristics of the Swift language • Set expectations and provide reference material
    Swift Review – Flow of Control and Optionals
    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. • Review the important Swift flow of control features • Highlight the unique characteristics of the Swift language • Set expectations and provide reference material
    What’s New in Swift 2?
    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. • Review the important additions to the Swift programming language • Highlight the important changes to the language
    Functional Programming
    Swift is often referred to as a functional language, though most programmers have exploited only the object-oriented side of the language. • Introduce functional programming • Discuss the benefits of functional programming • Discuss when to use it
    Protocol Oriented Programming
    Most programmers are not familiar with the concept of protocol-oriented programming though it’s Apple’s preferred approach for Swift. • Explain the concept and why protocol-oriented programming is important • Illustrate using examples
  • Advanced Language Features and Functional Concepts
    Introducing Game of Life
    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. • Introduce Game Of Life • Set up the boilerplate code for the application • Run the application
    Function Value Types and Closure Syntax
    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. • Remove the logic from our initializer for clarity • Look at some options and explore syntax • Utilize a lazy variable
    Often we’ll find ourselves needing to extend a class' functionality. In this video, we’ll see how we can extend any class. • Go over the extension syntax • Look at a simple use case • Write our own extension and incorporate it into our game
    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. • Explain how generics work • Work through a generics example • Reimplement our extension with generics
    Higher-order Functions – 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. • Introduce higher order functions • Take a look at filters and understand them • Implement filters in our game
    Higher-order Functions – Map
    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. • Explore map’s declaration • Explore how a map works • Improve our game’s functionality
    Higher-order Functions – FlatMap
    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. • Look at the FlatMap syntax • See how to use FlatMap by example • We finish by implementing FlatMap in our application
    Higher-order Functions – Reduce
    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. • Take a glance at reduce's declaration • Experiment with the syntax while incorporating reduce • Look at functional chaining
    Sequences and Generators
    We’ve encountered SequenceTypes and GeneratorTypes a few times already, but we haven’t explained them. This video does just that. • Look at the definitions in the Swift Standard Library • Make your own GeneratorType • Make your own SequenceType
  • Exploring Swift’s Memory Management
    What Is ARC?
    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. • Discuss a brief history of memory management • Explain how ARC reduces problems • Provide an example of allocation and deallocation in Swift
    Introduction to Instruments
    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. • Introduce the Instrument’s Allocations tool • Attach our session to Instruments • Monitor our project into Instruments
    Strong Reference Cycles
    Most new iOS developers are entirely unaware of Strong Reference Cycles. In this video, we’ll understand what they are and create one. • Learn about Strong References • Create a Strong Reference • Identify a memory leak in instruments
    Fixing our Leak – Weak and Unowned References
    In the previous video, we created a memory leak. In this video, we’ll resolve this issue by introducing a weak reference. • Introduce weak and unowned references • Understand the use cases for weak and unowned references • Implement a weak reference to resolve the leak
    Creating a Zombie
    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. • Define what a Zombie is • Utilize an UnsafeMutablePointer<T> to create a C pointer • Create the Zombie!
    8 Tips to Improve Memory Performance
    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. • Go through a list of what will help boost performance • See examples to improve memory performance
  • Interoperability and Working with 3rd Party Libraries
    Implicit Bridging and Cocoa
    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. • Investigate common Swift syntax • Discuss how Swift converts simplicity to Objective-C
    Exposing Swift to Objective-C
    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. • Learn the different ways to expose your code • Create a simple Objective-C project • Call a Swift method from Objective-C
    Using Objective-C in Swift
    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. • Create a new Swift project • Add some Objective-C code • Bridge our Swift with Objective-C using Bridging headers
    Interacting with C
    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. • Create a Swift project • Import c code into the project • Bridge C with Swift via a bridging header
    Wrapping C++ for Using in Swift
    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. • Create a new Xcode project, and add some C++ code • Wrap C++ in a C function • Indirectly Call the C++ code from Swift
    Working with CocoaPods
    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. • Install cocoa pods • Set up a pod file • Install alamofire using cocoa pods
    Incorporating an Objective-C Library
    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. • Download the SWRevealViewController project files • Add the project files along with a bridging header • Utilize the framework as intended
  • Concurrency and Grand Central Dispatch
    Understanding Concurrency
    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. • Take a look at single-core processing • Learn how multicore processors manage tasks • Learn about threads
    Threading with NSThread
    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. • Introduce NSThread in cocoa • Create your own threads • See your threads in action
    Locking Threads
    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. • Introduce NSLock • Implement NSLock • See how NSLock fixes our problem
    Asynchronous Methods
    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. • Identify an asynchronous issue • Implement a completion handler • Fix the sync issue
    Concurrency with NSOperationQueue
    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. • Take a look at NSOperationQueue • Implement a background queue • Jump in and implement a main queue
    Grand Central Dispatch
    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. • Get an introduction to GCD • Understand the difference between GCD and NSOperationQueue • Replace our code from the previous video with GCD
    Working with Dispatch Queues
    ‘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. • Introduce the different types of queues • Take a look at a few common use cases
    Asynchronous Programming with Dispatch Groups
    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. • Introduce a simple problem with our application • Explain how dispatch groups solve the problem • Resolve the problem with dispatch groups
  • Troubleshooting, Advanced Debugging, and Error Handling
    The LLDB Debugger
    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. • Introduce the breakpoint navigator • Introduce the variable pane • Explain the lldb prompt
    Advanced Breakpoints
    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. • Introduce conditional breakpoints, breakpoint actions, symbolic breakpoints, and exception breakpoints • See how advanced breakpoints work
    The LLDB Command Language
    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. • Introduce the concept of LLDB commands • Take a look at help, print command, and navigate breakpoints using LLDB commands • Check out how to manipulate session variables
    Address Sanitization
    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. • Create a buffer overflow in C • Analyze the crash that occurs without address sanitization • Enable sanitization to see useful error information
    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. • Introduce and understand the concept of assertions • Take a look at an assertion use case • Introduce the other assertion types available
    Error Handling
    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. • Introduce an unhandled error • Create our own error type to help us • Learn how to effectively catch an error
  • Performance Optimization and Introduction to Algorithms
    Identifying Performance Bottlenecks with XCTest and Time Profiler
    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. • Run ‘Game of Life’ in Time Profiler • Identify the expensive computation • Test the computation for performance
    Whole Module Optimization
    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. • Switch the whole module optimization on • Measure the performance of your code with and without whole module optimization by using instruments
    Reducing Dynamic Dispatch
    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. • Take a look at dynamic dispatch • Understand the performance implications • Introduce the final keyword
    Reference Types and Performance
    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. • Create a class and struct version of int • Create struct and class operators • Measure the performance between reference and value types
    Generic Specialization
    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. • Understand the problem with generics • Wire up a test project • Test our performance with whole module optimization
    Choosing the Right Algorithm
    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. • Get an introduction to the Big O notation • Wire up two different algorithms that perform the same task • Measure the performance between two search algorithms
    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. • Notice a repetitious pattern in our computations • Wire up a manual cache • Deconstruct a generic memoize function
  • Design Patterns
    Design Patterns Overview
    Not all programmers are aware of design patterns or, if they are, why they are important. In this video, we’ll discuss design patterns and explain how they can help resolve common programming problems. • Introduce the concept of design patterns • Understand why we need design patterns • Take a look at the three types of design patterns
    Singleton Pattern
    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. • Understand the concept of singleton • Demonstrate the problem when creating multiple instances of a single resource • Implement the singleton pattern to resolve this problem
    Factory 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. • Introduce the concept of factory pattern • Implement the Factory pattern • Check out the Factory pattern in action
    Adapter 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. • Compare two incompatible APIs • Develop an adapter to adapt the two APIs
    Façade 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. • Introduce the multiple interfaces problem • Implement the Façade Pattern • Run our application to review whether Façade solves our problem
    Chain of Responsibility 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. • Introduce the chain of responsibility pattern • Implement the chain of responsibility pattern • Dive deeper into how chain of responsibility works
    Observer 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. • Introduce the concept of Observer pattern • Implement the Observer pattern • See the observer pattern in action


  • Swift 2.0

Similar Courses

More Courses by this Instructor