Top 30 Advanced iOS & Swift Concepts Quiz
30 advanced multiple-choice iOS & Swift concept questions, the corners that separate having used it from understanding it: internals, edge cases, and the reasons behind the design. They come from 30 bites in the iOS & Swift library, the hardest slice of the 180 iOS & Swift concept questions in the library. Answer them here or read straight down. Every question carries the correct option, why it is correct, and a link to the bite it came from.
SwiftUI, UIKit, Xcode, Swift language, Apple platforms
30 questions. Pick an answer, or open “Show the answer” to read it.
Answers are graded in your browser. Nothing is saved, and no XP or streak is earned here. The app keeps score.
Question 1 of 30
In performance-critical Swift code, why is 'some Protocol' generally preferred over 'any Protocol'?
Show the answer
Answer: b · It guarantees a specific, consistent concrete type at compile time, enabling static dispatch and avoiding existential container overhead.
The card states that 'any Protocol' incurs performance costs due to dynamic dispatch and potential heap allocation for its existential container. 'some Protocol' avoids this by promising a specific concrete type at compile time, allowing for static dispatch and better performance. Option C is incorrect because protocols do not define stored properties; that is a feature of concrete types or class hierarchies.
Read the full bite: Protocols: Swift's Blueprint for Behavior
Question 2 of 30
What is the primary issue that "weak" or "unowned" references are designed to resolve in Swift's ARC?
Show the answer
Answer: b · Preventing memory leaks caused by two class instances holding strong references to each other.
The card states that `weak` or `unowned` references are used "To break these cycles" which occur "when two class instances hold strong references to each other, preventing either from ever being deallocated," leading to memory leaks. While `weak`/`unowned` help with deallocation, their primary role is to resolve the specific problem of strong reference cycles, not general unreachability.
Read the full bite: Automatic Reference Counting (ARC): Swift's Memory Manager
Question 3 of 30
What is the fundamental behavior of the "await" keyword within an "async" function in Swift?
Show the answer
Answer: d · It suspends the current task, allowing the system to use the thread for other pending work.
The "await" keyword suspends the current task, returning the thread to the system to perform other work until the awaited operation completes. It does not block the thread, which is a common misconception.
Read the full bite: async/await: Write Concurrent Code That Reads Synchronously
Question 4 of 30
Why do type errors in result builder code sometimes reference compiler-generated boilerplate instead of the original developer code?
Show the answer
Answer: d · Because the compiler performs a silent source-to-source rewrite into static method calls during type checking, and errors are reported against the generated code.
The card describes result builders as a compile-time source-to-source rewrite into static method calls, so type errors surface on the generated boilerplate rather than the original code. Distractor A incorrectly attributes the transformation to runtime metaprogramming, when the card explicitly states the rewrite happens during type checking.
Question 5 of 30
Which statement best describes the primary role of an iOS provisioning profile within Apple's security model?
Show the answer
Answer: c · It guarantees that an app can only run on authorized devices, was built by a verified developer, and is allowed specific system capabilities.
The card states provisioning profiles enforce trust by bundling who built the app (certificate), where it can run (devices/App Store), and what it can do (entitlements). Option C accurately summarizes these three core functions. Other options describe security functions not primarily handled by provisioning profiles or misrepresent their verification mechanism.
Read the full bite: iOS Provisioning Profiles: Your App's Passport
Question 6 of 30
Which scenario is Time Profiler LEAST effective at diagnosing as the primary cause of an app's performance issue?
Show the answer
Answer: c · An app becoming unresponsive while awaiting a large network response.
Time Profiler is designed for CPU-bound performance issues, identifying where the CPU spends its time. It is less effective for I/O-bound problems like network waits, where the CPU is idle, as other tools are better suited to show why a thread is waiting.
Read the full bite: Xcode's Time Profiler: Hunting Down Performance Bottlenecks
Question 7 of 30
Which scenario is best suited for using Xcode's Memory Graph Debugger?
Show the answer
Answer: c · Pinpointing the exact objects involved in a strong reference cycle preventing deallocation.
The Memory Graph Debugger is specifically designed to visualize object relationships and identify retain cycles, which are a common cause of memory leaks where objects cannot be deallocated. Other tools like the Time Profiler or Allocations instrument are better suited for general performance or overall memory usage monitoring.
Read the full bite: Hunt Retain Cycles with the Memory Graph Debugger
Question 8 of 30
What is the fundamental principle governing how an event propagates through the Responder Chain?
Show the answer
Answer: b · The event travels from the most specific UI element upwards through its superviews and controllers until handled.
The card states that an event 'starts at the most specific object (the view that was tapped) and travels "up" a pre-defined path of potential responders.' Option B accurately describes this upward propagation. Option C is incorrect because events are not discarded if the first responder declines; they continue up the chain.
Read the full bite: The Responder Chain: Who Handles That Tap?
Question 9 of 30
For which scenario is ObservableObject the most suitable choice in SwiftUI?
Show the answer
Answer: a · Creating a shared data model (class) whose properties, when changed, should update multiple views.
ObservableObject is specifically designed for reference types (classes) that act as a single source of truth for shared data, allowing multiple views to observe and react to changes. Options A, C, and D describe scenarios better handled by @State, standard properties, or immutable data, respectively.
Read the full bite: ObservableObject: Making Data Drive SwiftUI Views
Question 10 of 30
Which scenario best justifies using UIViewRepresentable in a SwiftUI application?
Show the answer
Answer: a · To integrate a third-party SDK component that is only provided as a UIKit UIView.
UIViewRepresentable's primary purpose is to bridge existing, complex UIKit components into SwiftUI, especially when SwiftUI lacks a native equivalent or for third-party SDKs. Using it for simple views (Option C) is explicitly discouraged, and while it aids migration, it's not a single-step conversion of an entire app (Option B). While UIKit can be used for custom drawing, the card emphasizes leveraging *existing* complex components rather than creating new ones because SwiftUI's shapes are insufficient (Option D).
Read the full bite: UIViewRepresentable: Bridging UIKit and SwiftUI
Question 11 of 30
Which common problem in iOS app development does the Coordinator pattern primarily aim to solve?
Show the answer
Answer: a · View controllers becoming tightly coupled and difficult to reuse due to managing navigation logic.
The card explicitly states the pattern exists because 'view controllers become bloated with responsibilities, mixing view logic, business logic, and navigation flow. This creates 'Massive View Controllers' that are tightly coupled, hard to test, and nearly impossible to reuse.' Option A directly captures this core problem. While option B is a consequence of this coupling, it is not the primary problem itself.
Read the full bite: The Coordinator Pattern: Untangling iOS Navigation
Question 12 of 30
Which VIPER component is responsible for formatting data for presentation and directing the View on what to display?
Show the answer
Answer: b · The Presenter, as it acts as a middleman between business logic and the passive UI.
The Presenter is explicitly described as taking raw data from the Interactor, formatting it for display, and passing it to the View. The Interactor handles pure business logic, and the View is a passive display layer.
Read the full bite: VIPER: Taming Massive iOS View Controllers
Question 13 of 30
What is a fundamental characteristic of iOS State Preservation?
Show the answer
Answer: a · It is primarily used to restore the user's navigation path and view hierarchy after app termination.
State preservation is designed to restore the UI's navigation path and view hierarchy after an app has been terminated by the system. It is explicitly stated that it is not for saving critical user data, which is the role of other persistence mechanisms.
Read the full bite: iOS State Preservation: Resume Where You Left Off
Question 14 of 30
When a user taps a deep link to content requiring authentication, what is the best practice for a seamless experience?
Show the answer
Answer: b · Present the login screen, then automatically navigate to the deep-linked content upon successful authentication.
The card explicitly states that dropping the user on the home screen after login is a 'poor user experience'. The correct approach is to handle the login process and then automatically resume navigation to the specific deep-linked content. Embedding sensitive tokens in URLs is warned against due to security risks.
Read the full bite: Deep Linking: Go Beyond the App's Home Screen
Question 15 of 30
An app needs a single NavigationStack where users can navigate from a Category screen, to a Product screen, to a Review screen, three unrelated model types, and wants to build and restore that exact path programmatically from a push notification. Why is NavigationPath the right tool over a plain array based path?
Show the answer
Answer: b · NavigationPath can hold a single ordered stack of mixed, unrelated Hashable types and reconstruct them, while a typed array path is limited to one concrete type for the whole stack
NavigationPath's core feature is type erasure across a single stack, which is exactly what mixing Category, Product and Review in one path requires. Option B is wrong since NavigationStack does support a plain typed array as its path for simpler, single type flows, and option C is wrong because the back button comes from NavigationStack itself, not from which path type backs it.
Question 16 of 30
In a custom UIViewController transition, which action is essential to signal the system that the handoff between view controllers is finished?
Show the answer
Answer: b · Calling context.completeTransition() within the animation's completion handler.
The card explicitly states that calling context.completeTransition() in the animation's completion block is critical to signal that the handoff is finished. While other options like adding the 'to' view or defining duration are necessary parts of the transition, they do not fulfill the role of signaling completion to the system.
Read the full bite: Custom UIViewController Transitions: Beyond the Defaults
Question 17 of 30
What is the primary benefit of using NSPersistentContainer in modern Core Data applications?
Show the answer
Answer: c · It consolidates the setup and management of the Core Data stack into a single object.
NSPersistentContainer's main purpose is to simplify Core Data setup by encapsulating the model, coordinator, and context into one object, eliminating boilerplate. While it facilitates background operations, it does not guarantee all operations are off the main thread, as its viewContext is for UI work.
Read the full bite: NSPersistentContainer: Your Core Data Stack in One Object
Question 18 of 30
Which data model change in Core Data would necessitate a heavyweight migration rather than a lightweight one?
Show the answer
Answer: b · Changing an attribute's type from String to Date.
The card explicitly states that changing an attribute's type, such as from String to Date, requires a custom (heavyweight) migration because Core Data cannot automatically infer the transformation. The other options are all scenarios handled by lightweight migration.
Read the full bite: Core Data Migrations: Evolving Your App's Schema Safely
Question 19 of 30
What is the primary mechanism NSFetchedResultsController uses to keep a UITableView synchronized with its Core Data source?
Show the answer
Answer: c · It provides a delegate that receives precise notifications for individual object insertions, deletions, and updates.
NSFetchedResultsController uses a delegate to receive detailed, object-level change notifications (insert, delete, update, move), enabling precise and animated UI updates. It avoids inefficient full table view reloads, which is what option A describes as a less optimal approach.
Read the full bite: NSFetchedResultsController: The Bridge for Core Data & UI
Question 20 of 30
Which scenario best illustrates the appropriate use of a Swift TaskGroup?
Show the answer
Answer: b · Downloading an unknown number of images from a list of URLs, processing each download in parallel.
The correct answer describes processing a dynamic number of similar, independent tasks concurrently, which is the core purpose of TaskGroup. Options A and B are better handled by async let and unstructured Task respectively, while option D describes sequential, dependent operations.
Read the full bite: TaskGroup: Dynamic, Structured Concurrency in Swift
Question 21 of 30
Which animation scenario is the most appropriate use case for CAKeyframeAnimation?
Show the answer
Answer: b · Guiding a layer's position along a custom, non-linear path.
CAKeyframeAnimation excels at defining animations through multiple waypoints or along a complex CGPath, making it ideal for non-linear movements. Simple A-to-B transitions are better suited for CABasicAnimation, while spring-like physics are handled by CASpringAnimation.
Read the full bite: CAKeyframeAnimation: Animating Through Key States
Question 22 of 30
What is the primary reason to use an explicit CATransaction in Core Animation?
Show the answer
Answer: d · To group multiple layer property changes to animate as a single, synchronized unit.
CATransaction's core purpose is to define boundaries for batches of changes, allowing multiple property updates to be committed and animated together as one atomic unit. Option B is incorrect because CATransaction batches changes, rather than applying them immediately and individually.
Read the full bite: CATransaction: Grouping Core Animation Changes
Question 23 of 30
A custom SwiftUI Shape has a stored property called cornerCount that changes when state updates, but the shape conforms to Animatable with animatableData mapped only to a different property, sideLength. What happens when cornerCount changes?
Show the answer
Answer: d · The shape's corner count changes instantly on the next frame instead of animating, because only animatableData gets interpolated
SwiftUI only interpolates whatever is exposed through animatableData, so any other stored property, like cornerCount here, simply snaps to its new value on the next frame with no runtime error and no smooth transition. It does not crash, does not animate for free, and does not stop rendering, it just changes abruptly.
Question 24 of 30
A developer puts an expensive image-processing computation inside a custom GeometryEffect's effect(size:) function to drive a transform. What is the most likely consequence?
Show the answer
Answer: d · Visible jank, because SwiftUI calls effect(size:) on every single frame of the animation, potentially over a hundred times a second
SwiftUI calls effect(size:) on every frame of an animation to recompute the transform for that instant, so expensive work there directly costs frame time and causes visible stutter. It does not run just twice, there is no such compile restriction, and GeometryEffect's computation runs on the main thread along with the rest of view rendering, not automatically backgrounded.
Question 25 of 30
Which statement accurately describes how CAReplicatorLayer applies its instanceTransform to generate multiple copies?
Show the answer
Answer: c · Each successive copy applies the instanceTransform relative to the state and position of the immediately preceding copy.
CAReplicatorLayer's transformations are cumulative; each copy is transformed relative to the previous one, not independently from the original source. This allows for complex patterns to be built up sequentially.
Read the full bite: CAReplicatorLayer: A 'For Loop' for Layers
Question 26 of 30
Which core technology enables ARKit to accurately track a device's position and orientation within a real-world environment?
Show the answer
Answer: b · Visual-Inertial Odometry (VIO) integrating camera and motion sensor data.
ARKit explicitly uses Visual-Inertial Odometry (VIO), which fuses data from the device's motion sensors and computer vision analysis of the camera feed. While other options relate to positioning, they are not ARKit's primary mechanism for dynamic world tracking.
Read the full bite: ARKit: Building Augmented Reality on Apple Devices
Question 27 of 30
In the Core Bluetooth framework, which statement accurately describes the typical interaction between an iOS application and a BLE sensor like a smart glucose meter?
Show the answer
Answer: a · The iOS app acts as a Central, scanning for the glucose meter (Peripheral) and subscribing to its measurement characteristics.
The card explicitly states that an iOS app typically acts as a Central, scanning for and connecting to Peripherals like a glucose meter. It then subscribes to the Peripheral's characteristics to receive data. Options A and D incorrectly reverse the roles, while option D describes a high-bandwidth scenario not suitable for Core Bluetooth.
Read the full bite: Core Bluetooth: The Central vs. Peripheral Model
Question 28 of 30
Why does Apple's documentation warn against calling AVCaptureSession's startRunning method on the main thread?
Show the answer
Answer: d · It is a blocking call that can take noticeable time to configure hardware, freezing the UI if called there
startRunning synchronously negotiates with camera hardware and can take a perceptible amount of time, so running it on the main thread blocks user interaction; it does not fail silently or require the main run loop for frame decoding.
Question 29 of 30
A cross-platform team needs to parse user text for both standard named entities and internal company codenames entirely on-device. Why is Apple's Natural Language Framework alone insufficient?
Show the answer
Answer: a · It cannot recognize domain-specific terms not present in its OS-shipped training data.
The framework ships with general OS-trained models, so it cannot recognize custom vocabularies like internal codenames. Distractor B is tempting because older NLP solutions often required cloud APIs, but this framework is explicitly on-device and offline.
Question 30 of 30
What is a key characteristic of code suitable for performance testing with `measure`?
Show the answer
Answer: b · It represents a critical, isolated computational bottleneck.
The `measure` function is designed for micro-benchmarking isolated, deterministic code paths, such as algorithms or complex calculations, to detect performance regressions. It is explicitly stated not to use it for high-variance external dependencies like network requests.
Read the full bite: measure: Baseline and Compare Code Performance
Could you explain these out loud?
That is what an interview actually tests. Tezvyn gives you questions like these with what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.