Intermediate everything in iOS & Swift, page 2
map versus compactMap versus flatMap
Map transforms each element one-to-one; compactMap transforms then drops nils; flatMap transforms to sequences then concatenates.
dispatch_async versus Task.detached for offloading work
Dispatch_async submits a closure to a queue; Task.detached starts an unstructured async task off the current actor without inheriting context.
What an autoreleasepool is and when to add one manually
An autorelease pool holds objects until it drains; wrap tight loops creating many temporary ObjC objects in autoreleasepool to cap peak memory.
Exposing Swift classes to Objective-C
Subclass NSObject or mark members @objc, import the generated ModuleName-Swift.h, and accept that Swift-only types like enums with associated values cannot cross.
Struct versus class performance and memory tradeoffs
Structs are value types, often stack-allocated with no ARC; classes are heap-allocated reference types with retain counts.
Automatic signing: benefits and limitations on teams
Automatic signing creates certificates and profiles on demand and keeps them in sync, easing local setup; limits include proliferating certificates, weak CI fit, and less control for complex entitlements.
Phased release to limit update risk
Enable phased release so an approved update reaches a growing percentage of automatic-update users over seven days; pause if metrics spike.
Using dSYM files to symbolicate crash reports
A dSYM maps stripped memory addresses back to function names, files, and line numbers; matched by UUID it symbolicates the report to readable frames.
Ad Hoc versus external TestFlight distribution
Ad hoc installs on pre-registered device UDIDs without Apple review; external TestFlight reaches many testers via the app but needs Beta App Review.
Static library versus dynamic framework linking
Static code is copied into the executable at build time; dynamic is loaded at launch by dyld. Trade-off: static bloats the binary but avoids load cost; many dynamic frameworks slow launch.
Modularizing a monolithic iOS app
Extract low-dependency, high-reuse leaf code first behind clear interfaces, enforce boundaries, iterate inward.
Code coverage and its pitfalls
It measures executed lines, surfaces untested paths, and guides where to add tests.
Locating XCUITest elements without accessibility identifiers
Query by type, label, predicate, or index; chain queries to narrow scope.
Testing async code and completion handlers in XCTest
Create an expectation, fulfill it inside the completion handler, call wait with a timeout, or use async test methods.
Unit test a ViewModel with a mocked NetworkService
Inject the protocol, supply a mock returning canned data, assert published state transitions.
Display thousands of map annotations efficiently
Enable clustering via clusteringIdentifier, reuse views with dequeueReusableAnnotationView, render clusters with MKClusterAnnotation in viewFor.
Run a Core ML image model with Vision
Add the .mlmodel so Xcode generates a class, wrap it in a VNCoreMLModel, run a VNCoreMLRequest via a VNImageRequestHandler, read results off the main queue.
Track location continuously in the background
Set desiredAccuracy, distanceFilter, activityType; enable the Location background mode and allowsBackgroundLocationUpdates; request Always authorization.
Allow simultaneous pan and pinch gestures
Attach pan and pinch recognizers, set yourself as delegate, return true from shouldRecognizeSimultaneouslyWith, apply translation to center and scale to transform.
Build a custom circular progress bar in UIKit
Draw an arc with UIBezierPath, assign it to a CAShapeLayer path, set lineWidth and no fill, animate strokeEnd 0 to 1.
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