Skip to content
academia.sh

Unit 03 of 03

Memory and Advanced Features

Automatic reference counting, breaking retain cycles with strong, weak and unowned references, capturing in closures, property wrappers, result builders, and isolation under strict concurrency checking.

Published Updated

Lessons

  1. 01 Automatic Reference Counting Measures the point at which deinit runs once the last strong reference is released along four release paths, and shows that a second reference postpones that moment. 13 min read
  2. 02 Strong, Weak and Unowned References Measures that deinit never runs when two classes hold each other strongly, that weak and unowned break the cycle, and that an unowned reference cannot be read once its object is gone. 12 min read
  3. 03 Capturing in Closures Measures that a closure stored in an object's own property blocks deinit when it captures self, that a weak self capture list resolves it, and that a capture list is evaluated once when the closure is created. 13 min read
  4. 04 Property Wrappers Measures that the wrappedValue getter of a property wrapper runs on every access, that the initial value is set up once, and that a cached wrapper turns the moment into first use. 12 min read
  5. 05 Result Builders Writes a result builder of its own and measures that expressions in an unchosen if or else branch are never evaluated, that a for loop evaluates every element, and that the branch is chosen at run time and not at compile time. 12 min read
  6. 06 Concurrency Safety Measures that the lazy property of an actor is set up once under concurrent reads and that an async let whose result is never awaited is still evaluated; covers the Sendable and @MainActor boundaries and closes the course. 13 min read

Start typing to search.

↑↓ ↵ Esc navigate · open · close