Delegates in 10 Minutes | From Messy to Clean Code

Опубликовано: 16 Июнь 2026
на канале: StemFoxIO
64
6

Master the Swift Delegate Pattern in under 11 minutes. We build a delegate from scratch — protocol, weak reference, conformance — then break down when to use delegates vs closures, NotificationCenter, and SwiftUI's reactive tools.

Like this video? Check out the playlist ➡    • Swift Basics  
Watch This Next:    • The #1 Swift Technique That Will CHANGE Yo...  

Video Links
Swift Protocols documentation: https://docs.swift.org/swift-book/doc...

Connect with me!
X: https://x.com/StemFoxIO

Question - Have you ever been burned by a retain cycle? What tipped you off — memory graph, Instruments, or just a mysterious crash? Drop your war story in the comments.

Want to learn more? Here are some sources I've learned from. Plus, some purchases help the channel (Affiliate Links).

I love Big Mountain Studio's books. Detailed and image oriented. Check them out here https://www.bigmountainstudio.com/a/y...

⏰ Timecodes ⏰
0:00 - Intro
0:41 - The Problem with Direct Edits
2:15 - The Delegate Pattern
3:23 - Conform to the Delegate
4:27 - Multicast Delegate or Composite Pattern
5:22 - Benefits of the Delegate Pattern
7:07 - Why Strong Delegate References Are Bad
7:57 - Delegates and SwiftUI
8:20 - When to Use Closures
8:38 - When to Use Delegates
8:50 - When to Use NotificationCenter
9:51 - SwiftUI, Combine, and async/await
10:25 - When to Use What: The Decision Framework

#swift #ios #swiftui #iosdev #swiftprogramming #delegatepattern #protocols #weakreference #xcode #iosinterviewquestions

About:
StemFoxIO posts videos to help you become a better, more efficient iOS developer.