Skip to content
tezvyn:

iOS & Swift

SwiftUI, UIKit, Xcode, Swift language, Apple platforms

78 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 everything in iOS & Swift, page 2

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.

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…

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…

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

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

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.

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.

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.

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.

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.

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.

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.

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 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.

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.

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

Apple's Natural Language Framework

Apple's Natural Language Framework turns raw strings into structured meaning on-device without network calls. Tokenize queries or extract entities from user text locally. It is not infallible; heavy synchronous tagging on the main thread freezes your UI.

advanced2 min read

Result Builders: Declarative Swift DSLs

Result builders teach the compiler to fold expressions into one combined value, enabling declarative DSLs. SwiftUI relies on them to compose stacked views. Type errors surface on compiler-generated boilerplate instead of your original code.

Refining Objective-C APIs for Swift with NS_SWIFT_NAME
advanced1 min read

Refining Objective-C APIs for Swift with NS_SWIFT_NAME

NS_SWIFT_NAME gives Objective-C code a Swifty alias without changing the original API. Use it to modernize legacy frameworks by removing prefixes for Swift consumption.

Optimizing iOS App Launch Time
advanced2 min read

Optimizing iOS App Launch Time

An app launch is a race against the system's watchdog timer. The OS loads your app in two phases: pre-main and main. Optimizing both is key. The biggest footgun is ignoring the pre-main phase, where bloated dynamic libraries can kill performance.

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