1. Optionals and Safe Unwrapping
An Optional in Swift is a type that can hold either a value or the absence of a value, represented by nil. It is declared by appending a question mark to the type, as in var name:...
Read full chapter →The essential Swift Programming cheat sheet: 7 concise chapters you can read in minutes, distilled from the full deck. When you're ready, drill the flashcards or test yourself under exam conditions.
An Optional in Swift is a type that can hold either a value or the absence of a value, represented by nil. It is declared by appending a question mark to the type, as in var name:...
Read full chapter →A Protocol in Swift defines a blueprint of methods, properties, and other requirements that conforming types must implement. Classes, structs, and enums can all conform to a protoc...
Read full chapter →A closure in Swift is a self-contained block of functionality that can be passed around and used throughout the code. Closures have a syntax that resembles a function without a nam...
Read full chapter →Swift has two fundamental categories of types based on how they are stored and passed. Value types, which include structs, enums, and tuples, are copied when assigned or passed int...
Read full chapter →Generics enable developers to write flexible, reusable functions and types that work with any type. Instead of duplicating logic for each type, a generic placeholder like T is used...
Read full chapter →Swift uses a do-try-catch model for error handling that integrates well with the type system. Functions that can fail are marked with the throws keyword, and callers must explicitl...
Read full chapter →Memory management in Swift for class instances is handled by Automatic Reference Counting, or ARC, which tracks the number of strong references to each instance and deallocates the...
Read full chapter →Done reading?
Test yourself with the Swift Programming practice exam — timed questions, instant score, full review of wrong answers. Free.
🎯 Take the Practice Exam →