Structs and Enums in Swift

 Structures We’ve discussed classes in Swift and how they are the foundation of object-oriented programming. In addition to classes, we also have structures that provide similar functionality. A structure is similar to a class since it can also have methods, properties, and initializers, but a structure is a value type where classes are reference types. Every type in Swift is either a value type … Read moreStructs and Enums in Swift

Object-oriented Programming with Swift – Part 2

Initialization and Deinitialization Initialization is when we prepare to create an instance of a class. This process may involve configuring the properties or any other miscellaneous setup required before we can use that instance like opening a database connection, creating a save file, or opening a web socket. In Swift, we use initializers to run some code before the instance … Read moreObject-oriented Programming with Swift – Part 2

Object-oriented Programming with Swift

Basic Object-oriented Principles Before delving into Swift code, let’s first understand what it means to be object-oriented (OO) and the need for OO. We begin our discussion by talking about classes and objects. In software, sometimes it is not sufficient to have loose methods and data structures floating around in our source code. We need some structure … Read moreObject-oriented Programming with Swift

SpriteKit Game Development Tutorial – Sprites and Animations

Introduction If you’re an aspiring game developer or just want to target the iOS or macOS realms, you must know your way around SpriteKit. In case you didn’t know, SpriteKit is a game development framework provided by Apple, that offers a lot of tools and speeds up the development of your game, by allowing you … Read moreSpriteKit Game Development Tutorial – Sprites and Animations

Swift Tutorial 6 – How to Use Functions in Swift

In this post, we’re going to learn about how to define and call various types of Swift functions. A function is a self-contained block of code whose purpose is to perform a specific task. We use functions so that we can break up the main source code into manageable chunks. Also, if we need to repeat code, we can … Read moreSwift Tutorial 6 – How to Use Functions in Swift

Swift Tutorial 5 – How to Use Control Flow in Swift

In this section we’re going to look at the various looping constructs and decision statements that Swift supports. We’ll be learning about while, repeat-while, and the variations of for loops. Next, we’ll discuss decision statements such as the if, if-else, and switch case statements. Finally, we’ll finish this section by talking about the branching statements we can use to control the program flow. Looping … Read moreSwift Tutorial 5 – How to Use Control Flow in Swift

Swift Tutorial 4 – Collection Types Tutorial in Swift

Swift provides three main collection types we can use to store groups of related values. Arrays are linearly ordered by an index starting at zero. Sets contain unordered, unique values. Dictionaries store an unordered collection of key-value pairs. Arrays The above image shows what an array looks like graphically. Essentially, arrays are ordered lists of elements of the same type where the … Read moreSwift Tutorial 4 – Collection Types Tutorial in Swift

Swift Tutorial 3 – How to Use Strings in Swift

We’ve looked at mostly numerical types and data in the past, but, in this post, we’re going to be looking at character data. A string is a sequence of characters. That’s why it’s called a string: it’s a “string” of characters! We can create string constants and variables by enclosing the characters in double-quotes:  . If we want to … Read moreSwift Tutorial 3 – How to Use Strings in Swift

Swift Tutorial 2 – How to Use Operators in Swift

Since we’ve discussed variables, the next logical step is to actually do something with those variables! In this section, we’re going cover the different types of operators supported by Swift. Learn iOS by building real apps Check out The Complete iOS Development Course – Build 14 Apps with Swift 2 on Zenva Academy to learn Swift 2 and … Read moreSwift Tutorial 2 – How to Use Operators in Swift

Swift Tutorial 1 – Getting Started with Swift and Variables

What is Swift? Swift is a relatively new programming language created by Apple and used for iOS, Mac OS X, tvOS, and watchOS apps. Back in 2014, Apple announced the first version of Swift at WWDC. Apple claimed Swift was “Objective-C without the C” and it’s done a very good job at doing that. For those readers that know … Read moreSwift Tutorial 1 – Getting Started with Swift and Variables

Tutorials on game, web and mobile app development