**1. Is `Sendable` a protocol? Explain it.**
Yes. `Sendable` is a marker protocol for types that are safe to pass across concurrency domains (threads, actors) without data races. Value types whose members are all `Sendable` conform automatically. A class can conform only if it's immutable: mark it `final`, make every stored property a `let` of a `Sendable` type. If it manages its own synchronization (for example an internal lock), you can declare it `@unchecked Sendable`. Worth clarifying the naming: `Sendable` is the protocol, while `@Sendable` is the attribute you put on a closure.
**2. What are the ways a child view can pass data back to a parent in SwiftUI?**
Three main ways. `@Binding`, where the child mutates a value that's reflected in the parent's source of truth. A callback closure the parent passes in and the child calls. And `PreferenceKey`, which lets a child publish values up the view hierarchy to an ancestor. PreferenceKey is cleaner when the data has to reach a distant ancestor, since a callback would have to be threaded through every layer in between. (A shared `ObservableObject` or `@EnvironmentObject` is a fourth option.)
**3. What is actor reentrancy?**
Actors guarantee mutually exclusive access to their state, but only between suspension points. At every `await` inside an actor method the actor can suspend that task and run other queued work, so the actor's state may change across the `await`. This prevents deadlocks, but it means you can't assume state is unchanged after an `await`. You have to re-check any invariants once execution resumes.
**4. What is `withCheckedContinuation` used for?**
It bridges older completion-handler or delegate based code into async/await. You wrap the callback based API and call `continuation.resume(...)` exactly once when the callback fires. The "checked" variant verifies the continuation is resumed exactly once and flags misuse. Use `withCheckedThrowingContinuation` when the operation can throw, and `withUnsafeContinuation` when you want to skip the checks for performance.
**5. What is a Combine `Subject`?**
A `Subject` is a publisher you can also feed values into imperatively with `send`. `PassthroughSubject` has no stored value and only delivers events that happen after you subscribe. `CurrentValueSubject` holds a current value, emits it immediately to new subscribers, and updates whenever you send a new one.
**6. What are compiler directives and how would you use them?**
Conditional compilation flags like `#if DEBUG`, `#if RELEASE`, and `#if TEST` that include or exclude code at build time. You can define your own via Active Compilation Conditions in build settings and gate code with `#if MY_FLAG`. Related directives include `#available` for runtime OS checks, plus `#warning` and `#error`.
**7. System design: how does Server-Sent Events (SSE) work?**
It's a one-way stream from server to client over a single long-lived HTTP connection with the `text/event-stream` content type. The client opens the connection and the server pushes text events as they happen. It's unidirectional (unlike WebSockets, which are bidirectional), runs over plain HTTP, and has automatic reconnection built into the protocol. A good fit for live updates like breaking news or weather alerts.
**8. System design: how do push notifications work?**
The app registers with APNs and receives a device token, which it sends to your backend. When there's something to deliver, your server sends the payload and token to APNs over an authenticated connection (token based JWT or a certificate), and APNs delivers it to the device. The app handles it through `UNUserNotificationCenter`. Silent or background pushes use `content-available`. Key details are asking permission, and handling token refresh.
**9. Architecture round: given the different views of an app, code how it would work.**
This was a whiteboard style coding round in a single file that wasn't meant to compile. I laid it out in MVVM: the model types, a view model owning the state and business logic, and the views observing it. The interviewer was watching how I reasoned about data flow and iOS concepts as I went, not whether it built, so I talked through my choices out loud and kept the structure clean.
**10. Behavioral: tell me about yourself / what is your greatest achievement.**
Standard behavioral openers. I kept it short and tied my background as an iOS engineer to the team's work, then used my strongest, most concrete project as the achievement and focused on the impact and what I owned.