What are Protocols? How do We Use Them?

A protocol defines a “blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality”. They can give also give nominal types polymorphic behavior. In Swift, the “protocol can then be adopted by a class, structure [a struct], or enumeration [an enum] to provide an actual implementation of those requirements.... » read more

Memory Management in Xcode

Let’s being with a quick refresher on how Swift and Objective-C work with memory management. Stack vs Heap It’s firstly important to know that value types (like structs) will be stored on “the stack”, whereas reference types (basically meaning classes) are dynamically managed on “the heap”. N.B. The terms “the stack” and “the heap” can... » read more

Using Blocks (Obj C)

Blocks are a C-Based language-level feature found in C, Objective-C, and C++ and they define self-contained units of work (Objective-C borrows the name “Block” from SmallTalk, a language in it’s DNA). Blocks are like anonymous functions (lambda abstractions) in that they combine data with related behavior, but they can also have optional binding to stack/heap variables. For a deeper... » read more