Interview questions in iOS & Swift, page 5
Unit test a ViewModel with a mocked NetworkService
Inject the protocol, supply a mock returning canned data, assert published state transitions.
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.
Locating XCUITest elements without accessibility identifiers
Query by type, label, predicate, or index; chain queries to narrow scope.
Code coverage and its pitfalls
It measures executed lines, surfaces untested paths, and guides where to add tests.
Diagnosing and stabilizing flaky XCUITests
Identify timing races, animations, network variance, and shared state; fix with expectations, controlled launch state, and isolation.
Driving app state via launch arguments in XCUITest
Pass launchArguments and launchEnvironment, read them at startup to seed auth and flags, bypassing slow UI steps.
Adding a Swift Package dependency in Xcode
Add via File menu, paste the repo URL, choose a version rule like up-to-next-major, link the product to your target.
Package.swift manifest: library vs executable products
The manifest declares name, targets, dependencies, and products; a library is consumed by other code while an executable produces a runnable binary with an entry point.
Modularizing a monolithic iOS app
Extract low-dependency, high-reuse leaf code first behind clear interfaces, enforce boundaries, iterate inward.
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.
Developing a local Swift Package alongside an app
Add the package as a local dependency by dragging its folder into the project or workspace, so Xcode references the source on disk and rebuilds edits immediately.
App ID, provisioning profile, and signing certificate
The certificate proves who you are, the App ID identifies the app and its capabilities, and the provisioning profile binds certificate, App ID, and allowed devices so iOS trusts the install.
Archiving and uploading a build to TestFlight
Select a real-device or Any iOS destination, Product Archive, then in the Organizer distribute to App Store Connect, where the build appears for internal TestFlight testers after processing.
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.
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.
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.
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.
App Thinning: slicing, bitcode, and on-demand resources
Slicing delivers only the assets and code a device needs; bitcode let Apple recompile and re-optimize; on-demand resources defer large assets until requested.
Securely managing signing assets in CI/CD
Keep encrypted certificates and profiles in a controlled store or fastlane match repo, inject the decryption key and credentials via CI secrets, install into a temporary keychain per run.
Privacy manifests and the app privacy report
PrivacyInfo.xcprivacy declares collected data types, tracking, and reasons for required-reason APIs; Xcode aggregates your manifest plus SDK manifests into a privacy report.
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