When writing code in Swift, it is not uncommon to want to repeat the execution of a set of statements. Controlling the position of different characters in a game, looping through the photos in a library, looping over a list of tweets – they all require re-executing the same set of statements multiple times. In […]
Arrays, dictionaries and sets make up the three main collection types in Swift. We’ve already talked about Arrays in a previous post, and in this article, we’re going to move on and look at the second of these collection types: Dictionaries.
In today’s post we’re going to take a look at the different types of operators that are available in Swift. We’ll take a closer look at how the Swift compiler interprets the symbols and tokens we include in our source code and look at how the concepts of precedence and associativity play a key role in shaping the results of our expressions.
Like in C and Objective-C and pretty much every other programming language in existence, Swift uses constants and variables to store the values in your application. In this article, we’re going to look at variables and constants in Swift. Rules for Naming Variables As with other languages, constants and variables in Swift associate a name […]
In the last post, we looked at the basics of optionals in Swift, what they were and how to use them. In this post, I want to build on that core knowledge by looking at optional chaining.
As you may know, Swift is a type-safe language and good understanding of the data types that are available is therefore critically important. In this post, we’re going to start looking at these in detail with a look at the numeric data types available in Swit.