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

Working with Closures in Swift

Closures Closures are small, self-contained blocks of code that can be used in our code, not unlike a function. (The reason these are called closures is because they’re said to “close” over constants and variables.) Let’s first get some context for closures. Suppose we have an array of names that we want to sort. Well it turns … Read moreWorking with Closures 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

Tutorials on game, web and mobile app development