SwiftUI interview questions

State ownership, Observation, view identity, navigation, layout and the SwiftUI bugs interviewers love to show you.

7 quick facts

– interview-ready · 22 questions in this topic

– of 22 tried

Saved on this device. Interview-ready means you got it right on two different days. Guesses and hints count for less.

Questions

  1. SwiftUI vs UIKit: key differencesPredict
  2. Which property wrapper for which data?Pick the fix
  3. @State vs a plain varPredict
  4. @StateObject vs @ObservedObjectPredict
  5. @Observable model keeps resettingSpot the bug · Pick the fix
  6. @Observable vs ObservableObjectPredict
  7. @Bindable for passed-in modelsPick the fix
  8. @Binding and the $ prefixPick the fix
  1. View identity: if/else vs a modifierPredict
  2. Why body runs often, and keeping it cheapPredict
  3. .task vs .onAppear + TaskSpot the bug
  4. .task(id:) and built-in debouncingPredict
  5. NavigationStack and deep linksPick the fix
  6. Custom environment values with @EntryPick the fix
  7. ViewModifier vs AnyViewPick the fix
  8. .animation(_:value:) vs withAnimationPredict
  9. GeometryReader vs ViewThatFits and LayoutPick the fix
  10. UIViewRepresentable feedback loopsSpot the bug
  11. Loading and error state in SwiftUISpot the bug
  12. @FocusStateFill the blank
  13. @ViewBuilderPick the fix
  14. A timer that re-renders the whole screenPick the fix

Practise this topic

Flashcards · 29

Flip, then say if you knew it. Needs JavaScript; every answer is also on its question page.

Quick quiz · 22 questions

One exercise per question, checked as you go. Needs JavaScript.

Mock interview · 4 sets

Timed, out loud, then tick what you covered. Needs JavaScript.

Fix this PR · 4 reviews

Review a diff like a senior: flag the lines you'd comment on. Needs JavaScript.

Quick facts

Recall the answer first, then tap Show to check.