Skip to content
tezvyn:

iOS & Swift

SwiftUI, UIKit, Xcode, Swift language, Apple platforms

129 bites

Test yourself: Top 30 iOS & Swift interview questionsMultiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.

Interview questions in iOS & Swift, page 3

Explain the Coordinator pattern and the navigation problem it solves in MVC
intermediate2 min read

Explain the Coordinator pattern and the navigation problem it solves in MVC

This tests if you see view controllers bloat from absorbing navigation flow. A good answer names 3 problems (delegate bloat, massive view controllers, embedded routing) and says coordinators own creation and routing.

Pass data back from a modally presented view controller delegate versus closure
intermediate2 min read

Pass data back from a modally presented view controller delegate versus closure

This tests decoupled UIKit communication and memory safety. A strong answer outlines a weak delegate protocol and a closure with weak self, contrasting coupling and retain cycles. Red flag: singletons or direct parent references.

Handle a deep link URL in SceneDelegate and navigate to order detail.
intermediate2 min read

Handle a deep link URL in SceneDelegate and navigate to order detail.

Handles willConnectTo and openURLContexts; parses path with URLComponents; validates ID; pushes detail onto nav stack.

How do you pop to root in SwiftUI NavigationStack?
intermediate2 min read

How do you pop to root in SwiftUI NavigationStack?

This tests declarative state-driven navigation. A strong answer binds NavigationStack to a NavigationPath, passes the binding down, and clears the path to pop to root. A red flag is suggesting UIKit popToRootViewController or legacy isActive hacks.

What NavigationView limitations did NavigationStack solve for programmatic navigation?
advanced2 min read

What NavigationView limitations did NavigationStack solve for programmatic navigation?

This tests why NavigationView programmatic navigation was brittle. A strong answer contrasts scattered NavigationLink isActive booleans and broken multi-destination stacks against NavigationStack's unified path array. A red flag is calling it a simple rename.

How would you architect the app root for onboarding vs authenticated flows?
advanced2 min read

How would you architect the app root for onboarding vs authenticated flows?

Tests window root swapping and state-driven architecture. Use a coordinator to own the window, swap rootViewController between nav and tab controllers on auth changes, and crossfade. Red flag: onboarding modal over tabs or keeping both hierarchies alive.

Design state-driven navigation for a conditional wizard in UIKit and SwiftUI
advanced2 min read

Design state-driven navigation for a conditional wizard in UIKit and SwiftUI

This tests separating navigation state from UI. Model the flow as a state machine enum, derive the stack from state, and unit test transitions in plain Swift. A red flag is imperative pushes inside views or view controllers.

When is UserDefaults right, what are its limits, and native types?
easy2 min read

When is UserDefaults right, what are its limits, and native types?

Tests if you treat UserDefaults as a small preference store, not a database. Good answers name native plist types, cite no encryption and small size limits, and name Core Data or Keychain for heavy or sensitive data. Red flag: storing images or passwords.

How do you persist a custom Swift struct to JSON in Documents?
easy2 min read

How do you persist a custom Swift struct to JSON in Documents?

Tests fluency with Codable and FileManager sandbox APIs. Good answer: conform to Codable, encode with JSONEncoder, resolve Documents directory via FileManager URLs, write Data atomically, and reverse with JSONDecoder.

intermediate1 min read

Why store auth tokens in Keychain, not UserDefaults?

UserDefaults is an unencrypted plist readable from backups and on jailbroken devices; use Keychain Services, which stores encrypted items with access control; save with SecItemAdd and read with…

Describe a pattern for background Core Data fetches and UI updates
intermediate2 min read

Describe a pattern for background Core Data fetches and UI updates

This tests NSManagedObjectContext concurrency and queue confinement. Strong answer: create a background context, fetch, pass objectIDs or structs to main, then main context fetches by ID to update UI. Red flag: passing NSManagedObjects across threads.

Describe lightweight vs heavyweight Core Data migration and a heavyweight example
intermediate2 min read

Describe lightweight vs heavyweight Core Data migration and a heavyweight example

This tests inferred versus manual Core Data migrations. Contrast lightweight additive changes with heavyweight transforms like entity splits, citing promoting a string to a new entity. A red flag is claiming renames always need custom mapping.

advanced1 min read

Optimize a slow NSFetchedResultsController screen

Set fetchBatchSize so rows load in pages, use relationshipKeyPathsForPrefetching to avoid per-row faulting round trips, and add indexes matching sort and predicate to make queries fast.

advanced2 min read

Bulk-import large JSON into Core Data efficiently

Use NSBatchInsertRequest to write rows directly to the store, bypassing context object materialization, for huge memory and speed wins; limitation is it skips validation, relationships, and does not notify…

advanced2 min read

Design offline-first sync and conflict resolution

Queue local mutations with timestamps and sync state, push and pull deltas using a change token or updatedAt cursor, and resolve conflicts with a chosen policy like last-write-wins or field-level merge.

easy1 min read

Fetch and decode JSON with async/await and URLSession

Call URLSession.shared.data(from:) inside an async throws function, check the HTTPURLResponse status, then JSONDecoder().decode([User].self) and let errors propagate via try.

easy1 min read

Map JSON keys to differently named Codable properties

Declare a nested CodingKeys enum mapping userID to the raw value "user_id", or set the decoder's keyDecodingStrategy to convertFromSnakeCase for blanket conversion.

intermediate2 min read

URLSession data vs download vs upload tasks

Data tasks buffer responses in memory for small API calls; download tasks stream to a file and support background transfers for large files; upload tasks send bodies from data or files and report…

intermediate2 min read

Run two API calls concurrently with async let

Use async let to start two independent fetches that run concurrently, then await both, so total time approaches the slower call rather than the sum.

intermediate1 min read

What is @MainActor and why does it matter?

@MainActor is a global actor guaranteeing code runs on the main thread; annotate UI-updating types or methods so post-network state changes are main-thread safe.

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles