SwiftUI Weekly - Issue #226
The curated collection of links about SwiftUI. Delivered every Monday.
Reading
Monitoring app performance with MetricKit
Xcode Organizer provides access to essential performance metrics such as crashes, energy impact, hangs, launch time, memory consumption, and app terminations. However, it lacks sufficient information to resolve certain issues, particularly app terminations. To address this, Apple introduced the MetricKit framework, enabling us to collect comprehensive diagnostics and build a detailed performance dashboard.
Why Child @State Won't Update from Parent in SwiftUI
@State is designed to manage a view’s internal private state. Its initial value is only applied when the view establishes its Identity for the first time. To react to external data changes continuously, use @Binding or standard let properties instead.
Animating SF Symbols in SwiftUI
SF Symbols are a natural choice for icons in SwiftUI apps. The system provides a very large symbol catalog, and extensive customization options. Size, weight, rendering mode, and color can all be adjusted to match the surrounding UI, making symbols easy to integrate across an app.
From broken to testable SwiftUI navigation: The decoupled approach of MVVM with coordinators
SwiftUI provides several tools for managing navigation, and the introduction of NavigationStack and value-destination links improved programmatic navigation.
However, in larger applications, vanilla SwiftUI navigation can pose challenges for testability, maintainability, and modularity. Navigation logic is distributed across views, introducing coupling and making the navigation code hard to locate.
Reducing the Number of .sheet Modifiers in Your SwiftUI Views
When a SwiftUI view needs to present many different sheets, each sheet typically requires its own @State Boolean and .sheet modifier. This quickly clutters code and makes it hard to maintain.
