Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m

Next lesson playing in 5 seconds


Free Preview: Swift Design Patterns


  • Overview
  • Transcript

As you grow your skills as a coder, it's important to go beyond language syntax and functionality. Design patterns have evolved over the years to solve common problems that arise in development. Once you learn a design pattern, you'll use it over and over in many different languages. However, design patterns themselves can be abstract and hard to understand at first.

In this course, Derek will teach you some of the most common patterns. More importantly, he will explain and demonstrate how these patterns can be applied using the Swift programming language. For each pattern, you'll see a complete example in code, and you'll get an explanation of the specific challenge the pattern is solving. By the end, you'll have some powerful new coding tools in your toolkit.

We've built a complete guide to help you learn Swift, whether you're just getting started with the basics or you want to explore more advanced topics: Learn Swift.

1. Introduction

1.1 Introduction

Strategy, Command, Factory. These are all names of some very common, and well-known, and well-defined design patterns in software development. But what are design patterns? How do I identify them? How do I use them? And most importantly, how do they affect me as a Swift developer? Well these are all very important and yet complicated questions if you've never had much experience with design patterns. That's why, over the duration of this course, I'm going to take all of the most commonly used design patterns. And I am going to put them together in groups known as Creational, Structural, and Behavioral. And once we've done that, we are going to take each one of these patterns. And we're going to identify some common situations where they are applicable. But not only where they're applicable, also how to use them. And how to use the Swift programming language to implement them. Now this is a very basic course that's going to teach you a lot of the fundamental concepts. Not only of each and every one of these patterns, but also how to apply them to everyday scenarios. Now if you're like me, and you've ever done any sort of searching online. You've probably seen more than your fair share of design pattern UML diagrams. And these are all really great, but they can oftentimes be very difficult to understand. That's why in this course I am going to boil all of the examples down to very easy to understand examples, to help you better understand what design patterns are, where they're applicable. And ultimately, how to use them in your day to day development.

1.2 Prerequisites

Let's take a few minutes to talk a little bit about some prerequisites that are gonna be necessary to follow along successfully in this course. Now in this course we're gonna be talking about design patterns. And while design patterns are not specific to any sort of technology or language. We will be using Swift in this course, and more specifically, we'll be focusing on Swift 3. Now, in order to do that, you will more than likely need a Mac. And in this case I have my MacBook Pro. And on here you´re also gonna need the proper tooling. And in this case, that's going to be Xcode. Now, Xcode is freely available from the App Store. All you need to do is fire up the App Store, search for Xcode. And download whatever the latest and greatest version is, and at this point, it's 8.3.3. Now I'm actually running 8.3.1. So as you can see, pretty much any sort of 8.3.x version should work just fine. Now having said that, just because we are using Swift 3 in this course doesn't necessarily mean that you can't use Swift 2. Because design patterns are really accessible to just about any sort of object oriented programming language. You could adapt the concepts that I'm gonna be talking about to just about any other object-oriented language. So maybe if you have an earlier version of Xcode and are maybe using Swift 2, you could probably adapt it to follow along. Now there will be certain cases where I will be using features that are more available to Swift 3. But like I said, you can get around some of those if you're familiar enough with the earlier versions of the language to adapt it to your needs. But in order to follow along more successfully, you probably want to have at least Swift 3. That would probably be your best bet. Now also I am going to be making the assumption that you have at least a basic understanding of the Swift programming language itself. This is not an in-depth course on the language itself. But we will be using some of the language constructs within Swift to be able to take advantage of these design patterns. So if you've never used Swift before, if you've never done any sort of Apple platform development. You may want to head back to some of the other Tuts courses, and take a look at some Swift programming courses. As well as some basic maybe iOS development courses to help you understand some of the fundamental concepts that you're gonna need to be able to follow along with this course. And once you've done that and have a basic understanding, you will absolutely be ready to go and follow along. So now that you have Xcode downloaded and installed and a basic understanding of the Swift programming language. Let's go ahead and get started talking about design patterns.