Classes – Intermediate

A few concepts for taking your understanding of Classes to the next level in Swift. I am certain many if not all of these are techniques you will use over and over. This post continues on where Swift Classes – The Basics left off, so if you are not familiar with classes you will want to check out that post as well.

Read Full Article…Classes – Intermediate


In Swift an Optional Type is considered a safe way to use variables. An Optional can represent a value that has been set or more importantly the lack of a set value as they default to nil when no value is present (yes that technically means they do always have a value). You tell Swift that you want to use an optional type by using ? after the variable type, so for example.

Read Full Article…Optionals

Closures – The Basics

You maybe familiar with Closures from other languages, simply put they are blocks of code assigned to a variable. In this example we create a closure called welcome take note of the syntax in this example, it takes no arguments but returns a string. Then we simply call it like a function, try this in a playground and see what you get back, it should be “Hello!”

Read Full Article…Closures – The Basics

Classes – The Basics

Classes in Swift are something you will be using a lot if you want to really get to grips with creating applications. I suggest that if you do not know what Object Oriented Programming methodology is that you at least read up on the basics before starting any serious development, there is a highly regarded book by Erich Gamma on the subject titled Design Patterns: Elements of Reusable Object-Oriented Software.

Classes in Swift are simple to create and use, this is I feel an improvement over Objective-C where at times it felt harder than it needed to be due to the syntax involved.

To follow along I suggest creating a playground so you can instantly see the results.

Read Full Article…Classes – The Basics