# ios & swift
// [55] real interview questions. Answers and sources live in the practice app.
practice this topic- How is memory managed on iOS? What does ARC do automatically, and what does it not handle?(junior)
- What is a retain cycle, where do they typically appear in real code, and how do you break one?(mid)
- Explain the difference between strong, weak, and unowned references. When is unowned actually safe?(mid)
- Why do you capture [weak self] in escaping closures? When is it unnecessary noise?(mid)
- Your app's memory footprint keeps growing during a session and eventually gets jetsam-killed. How do you find the leak?(mid)
- What is the difference between a struct and a class in Swift, and how do you decide which to use?(junior)
- What problem do optionals solve in Swift, and what are the different ways to unwrap one? When is force-unwrapping acceptable?(junior)
- Explain synchronous vs asynchronous execution, and serial vs concurrent queues. How do the two axes differ?(junior)
- What is Grand Central Dispatch and how do you use it correctly in an app?(mid)
- Users report the app freezes for a second when opening a particular screen. How do you diagnose and fix a main-thread hang?(mid)
- What is a race condition, and what tools does the platform give you to prevent or catch data races?(mid)
- Compare GCD completion-handler code with Swift's async/await. What concrete problems does structured concurrency solve, and when would you still touch GCD?(senior)
- How do you run asynchronous work from a SwiftUI view, and what happens to that work when the view disappears?(mid)
- Explain @State and @Binding in SwiftUI. Who should own a piece of state, and how does ownership flow down the view tree?(mid)
- @StateObject vs @ObservedObject: what bug do you get when you pick the wrong one, and why does it happen?(senior)
- What is @EnvironmentObject, when is it the right tool, and what is its failure mode?(mid)
- Describe the lifecycle of a SwiftUI view. How is it fundamentally different from a UIViewController's lifecycle?(mid)
- What is the difference between viewDidLoad and viewDidAppear, and what work belongs in each?(junior)
- Delegation, NotificationCenter, and KVO all communicate between objects. How do you choose between them?(mid)
- When would you use Core Data over UserDefaults, and what should never go in UserDefaults?(mid)
- Explain iOS code signing: what are certificates and provisioning profiles, and how do you debug a 'provisioning profile doesn't match' failure?(mid)
- Product asks: 'sync the user's data every 15 minutes, even when the app is closed.' What do you tell them, and what can iOS actually do in the background?(senior)
- Typing in one text field makes your whole SwiftUI screen stutter. How do you diagnose and fix a body re-evaluation storm?(senior)
- You enable Swift 6 strict concurrency and get hundreds of Sendable errors. What is the compiler actually proving, and what is a sane migration strategy?(senior)
- Actors serialize access to their state — so why can you still get interleaving bugs inside an actor? Explain actor reentrancy.(senior)
- Custom URL schemes vs universal links: how do they differ, and your universal link opens Safari instead of the app for some users — what do you check?(mid)
- Push notifications work in testing, but a chunk of production users 'never gets them'. What edge cases do you investigate?(senior)
- Your iOS app's download size crossed 200 MB and conversion is dropping. How do you diagnose and shrink app size?(mid)
- What StoreKit 2 mistakes lead to 'user paid but didn't get the content'? Name the pitfalls a purchase implementation must handle.(senior)
- Design offline-first sync for an iOS notes app: edits must work in airplane mode and sync later. What are the moving parts and failure modes?(senior)
- Why can't a WidgetKit widget run a live countdown or fetch data whenever it wants? Explain the widget execution model.(mid)
- When is a Live Activity the right tool, and what hard platform constraints does it impose?(mid)
- What does @MainActor actually guarantee, how does it replace DispatchQueue.main.async, and where can main-actor code still go wrong?(mid)
- You cancel a Swift Task but the work keeps running and the UI updates anyway. Why — and how does cooperative cancellation actually work?(mid)
- Your app takes 4 seconds to cold launch. What actually happens during launch, and how do you get it under a second?(senior)
- Your SwiftUI List of 5,000 items scrolls badly and animations glitch when items change. What role does identity play, and what are the fixes?(mid)
- Your feed calls MainActor.run inside a scrolling loop to update a label and Instruments shows main-thread contention. Why is hopping to the main actor per item a design smell, and how do you batch UI updates correctly?(senior)
- Instruments' Allocations shows your app's memory climbing during image-heavy scrolling and never coming back down until a jetsam. Walk through diagnosing whether it's a leak, abandoned memory, or just a cache that never evicts.(senior)
- A cold launch from a push notification tap needs to land the user on a specific chat, but sometimes it opens the home screen instead. What's racing, and how do you make deep-link routing deterministic?(mid)
- You need to store an auth token and a small user profile on device. Walk through why Keychain (not UserDefaults) for the token, and the flags that decide when it's readable.(mid)
- Combine vs async/await vs AsyncSequence for reactive data flow in a modern SwiftUI app: how do you choose, and what does Combine still do that async/await doesn't?(senior)
- What is copy-on-write for Swift value types, why does it matter for performance, and how can you accidentally defeat it?(mid)
- A background URLSession upload works on the simulator but on real devices the completion sometimes never fires and the app 'forgets' the transfer. What's different about background sessions, and how do you handle their lifecycle correctly?(senior)
- SwiftData or Core Data for a new offline-first app in 2025? What does SwiftData give you, and what makes teams still reach for Core Data?(mid)
- You need to test a StoreKit 2 subscription flow — free trial, upgrade, refund, Ask to Buy — without shipping to real users. What are your options and their traps?(senior)
- An App Store reviewer rejected your app for 'requesting location before explaining why'. What does correct iOS permission UX look like, and what technically happens if you get it wrong?(mid)
- In SwiftUI, when should a view use @State vs move logic into an @Observable model, and what problem does the Observation framework fix over ObservableObject?(mid)
- Explain value vs reference semantics with a concrete bug: you pass a model to two view controllers and editing it in one unexpectedly changes the other. What happened and how do you choose the fix?(junior)
- A crash reported by users never reproduces for you, and the crash log points into system frameworks with no symbols. How do you make crash reports actionable?(senior)
- What is the App Tracking Transparency framework, and when does an app actually have to show the prompt versus just complete the privacy nutrition label?(mid)
- Your app must share data between the main app and its widget/extension. The widget shows stale data and sometimes the app crashes writing the shared file. What's the correct architecture for app-group data sharing?(senior)
- A message arrives and your chat app lights up with a banner even though the app was fully closed and not running in the background. How does a push notification reach an app that isn't running?(mid)
- You force-quit an app, come back to it days later, and it opens exactly on the screen and scroll position you left. Since the process was killed, how does the app restore that UI?(junior)
- When you unlock your phone with your face, the app that uses it never seems to receive your actual face data. Where is the face stored, and what does an app actually get back from Face ID?(senior)
- Your fitness app shows a live step count even when you never opened it all afternoon, and it drains almost no battery. How does an iPhone count steps for an app that wasn't running?(mid)