Skip to content
tezvyn:

iOS & Swift

SwiftUI, UIKit, Xcode, Swift language, Apple platforms

35 bites

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

Advanced interview questions in iOS & Swift

advanced1 min read

Why can't you subscript a Swift String with an Int?

Characters are extended grapheme clusters of variable byte width, so integer offsets are not O(1) or meaningful; String.Index is an opaque position you advance via the collection.

advanced1 min read

What is @autoclosure and when is it useful?

@autoclosure wraps an argument expression in a closure so it evaluates lazily only if used, enabling clean APIs like assert and the ?? operator.

Explain Copy-on-Write in Swift and implement it for custom structs
advanced2 min read

Explain Copy-on-Write in Swift and implement it for custom structs

Tests value semantics with reference storage and uniqueness checks. A strong answer explains CoW delays copy until mutation via isKnownUniquelyReferenced, lists custom steps: wrap, read, check, clone. Red flag: assuming structs are automatically CoW.

advanced2 min read

How does Swift async/await improve on completion handlers?

Tests structured concurrency mastery over callback control flow. A strong answer covers inversion of control, suspension points as yield locations, and Tasks as parent-child units.

How does Debug Memory Graph find leaks and retain cycles?
advanced2 min read

How does Debug Memory Graph find leaks and retain cycles?

This tests knowledge of Xcode's heap visualization versus allocation sampling. A strong answer notes the graph shows objects, draws retain cycles as loops, and contrasts with Leaks time-based sampling. Red flag: expecting leak flags without inspection.

What build settings improve Time Profiler symbols in Release builds?
advanced2 min read

What build settings improve Time Profiler symbols in Release builds?

This tests debug symbol control in Xcode Release builds. Set DEBUG_INFORMATION_FORMAT to DWARF with dSYM, avoid stripping, citing larger size and slower links. Red flag: suggesting you disable optimizations, invalidating the performance profile.

How would you use Energy Log to investigate battery drain?
advanced2 min read

How would you use Energy Log to investigate battery drain?

Tests correlating Instruments energy metrics to app behavior. Strong answers profile with Energy Log, map CPU/Location/Network spikes to user flows or background work, and validate fixes with before/after logs. Red flag: blaming the OS without evidence.

advanced1 min read

How does Auto Layout resolve constraints?

Auto Layout solves a system of prioritized linear equations; intrinsicContentSize is a view's natural size; hugging resists growing, compression resistance resists shrinking.

advanced1 min read

How do you build a custom SwiftUI Layout?

Conform to Layout, implement sizeThatFits to report the container size for a proposal, and placeSubviews to position each subview using its measured size.

advanced1 min read

Diagnose and fix slow iOS app launch time

Pre-main covers dylib loading, rebasing, and static initializers; main covers didFinishLaunching and first frame; profile with Instruments, then defer work, reduce dynamic libraries, and trim…

Outline the key steps and APIs for State Preservation and Restoration
advanced2 min read

Outline the key steps and APIs for State Preservation and Restoration

Tests UIKit's automatic state restoration pipeline. Strong answers cover: opting in via AppDelegate, setting restorationIdentifiers, implementing encode/decodeRestorableStateWithCoder, and the system snapshot cycle.

advanced1 min read

Compare MVVM with unidirectional flow (TCA, Redux)

MVVM is lightweight with bidirectional binding and per-screen view models; unidirectional flow centralizes a single state mutated only by reducers via actions, gaining predictability and testability at…

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.

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.

advanced1 min read

How task cancellation works with async/await

Cancellation is a flag, not a kill; check Task.isCancelled or call checkCancellation, URLSession throws CancellationError automatically.

advanced1 min read

What is an actor and how does it prevent data races

Actors serialize access to mutable state, reachable only via await; compiler blocks unsafe access. Token-refresh actor coalesces concurrent refreshes.

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