What Not to Do: Rocky Road to Banner View
summary
Builds a SwiftUI banner component through three iterations: first a State-driven banner appears inside child view which breaks when a child should not host it, then a BannerManager via dependency injection and EnvironmentObject that becomes testable, and finally a solution using two view modifiers that create and inject the manager so views that don’t need banners stay banner-free. Notes a practical downside: it crashes if the top-level modifier is forgotten and cannot be used inside UIKit screens.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 1:07Project overview
- 3:16First mistake
- 6:27Second iteration
- 8:18Final solution
- 11:32Key takeaways
- 13:56Conclusion
related talks
26mThe SwiftUI Mindset: 5 Key Ideas to Avoid Common Pitfalls
41mWhen You Can’t Go All In On SwiftUI, Build a Hybrid UI App Instead!
17mMastering SwiftUI Previews: How the Project Structure can hel
37mAdopting SwiftUI at scale
23mUsing SwiftUI as a Language
01h 10mHow to Design Your Own Banner Format Using Lamoda as an Example
41mSwiftUI Tutorial 2024: Master Navigation - NavigationStack, NavigationPath & NavigationDestination
41mLife Beyond Storyboards: Building your UI in code
