More in Mobile Dev — page 12
Compare MVVM with unidirectional flow (TCA, Redux)
WHAT IT TESTS: architectural trade-off judgment. OUTLINE: 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…
Diagnose and fix slow iOS app launch time
WHAT IT TESTS: understanding launch phases and profiling. OUTLINE: 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…
Explain UIKit MVC and the Massive View Controller problem
WHAT IT TESTS: understanding UIKit's core pattern and its pitfall. OUTLINE: Model holds data, View displays it, Controller mediates between them; the view controller accretes networking, parsing, and logic into a Massive View Controller.
Describe the iOS app lifecycle and SceneDelegate methods
WHAT IT TESTS: knowledge of app and scene states. OUTLINE: not running, inactive, active, background, suspended; SceneDelegate handles sceneDidBecomeActive, sceneWillResignActive, sceneDidEnterBackground, sceneWillEnterForeground.
How do you build a custom SwiftUI Layout?
WHAT IT TESTS: SwiftUI's Layout protocol for bespoke arrangements. OUTLINE: conform to Layout, implement sizeThatFits to report the container size for a proposal, and placeSubviews to position each subview using its measured size.
How does Auto Layout resolve constraints?
WHAT IT TESTS: understanding constraint-based layout. OUTLINE: Auto Layout solves a system of prioritized linear equations; intrinsicContentSize is a view's natural size; hugging resists growing, compression resistance resists shrinking.
What is @autoclosure and when is it useful?
WHAT IT TESTS: understanding deferred, lazy evaluation. OUTLINE: @autoclosure wraps an argument expression in a closure so it evaluates lazily only if used, enabling clean APIs like assert and the ?? operator.
Why can't you subscript a Swift String with an Int?
WHAT IT TESTS: understanding Unicode-correct strings. OUTLINE: 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.
How does Swift's switch differ from C's switch?
WHAT IT TESTS: understanding Swift's safer control flow. OUTLINE: switches must be exhaustive, there is no implicit fallthrough between cases, and cases can match ranges, tuples, and bind values.
Test Plans (XCTestPlan)
A Test Plan is an Xcode configuration file decoupling which tests run from how they run, letting one scheme execute many configurations: localizations, sanitizers, randomized order, and repetition, all without editing the scheme.
Dart reduce versus fold on collections
WHAT IT TESTS: choosing the right aggregation. OUTLINE: reduce combines same-type elements and throws on empty; fold takes an initial value and accumulator of any type, safe on empty. RED FLAG: using reduce when the result type differs from the elements.
Auth-protected routes via GoRouter redirect
WHAT IT TESTS: guarding routes with redirect. OUTLINE: a top-level redirect reads auth state, sends unauthenticated users to login, sends logged-in users away from login, and uses refreshListenable to re-evaluate on auth change.
Isolating and reducing excessive widget rebuilds
WHAT IT TESTS: narrowing rebuild scope. OUTLINE: push state down, use const subtrees, rebuild only listeners with ValueListenableBuilder, isolate repaints with RepaintBoundary.
iOS code signing for a TestFlight release
WHAT IT TESTS: understanding Apple's signing model. OUTLINE: a signing certificate proves who built the app; a provisioning profile ties cert, app ID and devices together; configure in Xcode, archive and upload.
Testing a tap that triggers a SnackBar
WHAT IT TESTS: widget-test interaction flow. OUTLINE: pumpWidget the app, find the button, tester.tap it, call pump or pumpAndSettle to advance frames, then expect a SnackBar finder. RED FLAG: forgetting to pump after the tap so the SnackBar never appears.
MethodChannel data flow and type marshalling
WHAT IT TESTS: how platform channels marshal data. OUTLINE: Dart invokeMethod sends a StandardMessageCodec-serialized payload to native, which returns a primitive or map; complex objects must be reduced to supported types.
Building a custom implicitly animated widget
WHAT IT TESTS: understanding the implicit animation machinery. OUTLINE: extend ImplicitlyAnimatedWidget, use AnimatedWidgetBaseState, define tweens in forEachTween, read values in build.
Diagnosing and fixing CustomPainter jank
WHAT IT TESTS: optimizing custom canvas rendering. OUTLINE: avoid work in paint, gate repaints with shouldRepaint, isolate with RepaintBoundary, cache static layers. RED FLAG: blaming the device or repainting everything every frame.
Immutable bloc state versus mutable ChangeNotifier
WHAT IT TESTS: reasoning about state mutability trade-offs. OUTLINE: immutable gives predictable diffs, easy debugging and replayability at the cost of boilerplate; mutable is terse but error-prone. RED FLAG: declaring one universally superior with no nuance.
Provider package versus raw InheritedWidget
WHAT IT TESTS: why Provider wraps InheritedWidget. OUTLINE: it removes boilerplate, adds lifecycle disposal and scoped reads, and exposes select for granular rebuilds. RED FLAG: thinking Provider is unrelated to InheritedWidget or is its own state engine.