SwiftUI
Navigation state, re-render debugging, UIKit interop, and building components that scale.
- How do you mix UIKit and SwiftUI safely?UIHostingController embeds SwiftUI in UIKit and UIViewRepresentable embeds UIKit in SwiftUI, but the real discipline is one clear owner for shared state.
- What are SwiftUI's current limitations?Sheet-presentation keyboard focus timing, rich text editing, and exotic gesture composition with Canvas still lag native UIKit and AppKit in 2026.
- How do you debug unexpected SwiftUI re-renders?Self._printChanges() reveals which property triggered a body re-evaluation, and a broadly-scoped observable object is usually the real cause of the churn.
- How do you manage navigation state in SwiftUI?NavigationStack turns navigation into state via a NavigationPath owned by a router, though its type erasure often pushes teams toward a plain Route array.
- How do you design reusable SwiftUI components?Reusable components lean on ViewBuilder for structure and custom ButtonStyle or ViewModifier types for optional behavior, extracted only when needed.
- How do you avoid unnecessary view updates?Giving each view the smallest dependency surface, via @Observable's field tracking and passing specific fields instead of whole objects, cuts updates.
- How does SwiftUI diffing work conceptually?SwiftUI diffs new view values against a persistent render tree using type and position — or explicit IDs — as identity, updating only what changed.
- How do you implement custom transitions?Custom transitions wrap a ViewModifier's active and identity states in AnyTransition, which SwiftUI interpolates between on insertion and removal.
- What is the difference between Task {} and .task in a SwiftUI file?Task {} is an unstructured, manually-managed task, while .task {} is bound to a view's lifecycle and cancels automatically when it disappears.
- What is Identifiable, and why does it matter for List/ForEach?Identifiable gives value types a stable sense of "same thing over time" that List and ForEach need to diff insertions, removals, and reorders correctly.