Everything in Mobile Dev, page 9
Decoding a heterogeneous JSON array by a type field
Peek the type field with a partial decode, switch on it, and decode the concrete type, wrapping each in an enum or boxed protocol value.
Minimizing Storyboard merge conflicts
Split into many small storyboards or xibs, or move to programmatic or SwiftUI layout; process-wise coordinate ownership and merge often.
Faulting in Core Data
A fault is a placeholder object whose property data is not yet loaded; accessing a property fires the fault and fetches from the store, saving memory.
View identity in SwiftUI and the .id() modifier
Identity links a view to its persistent state and transitions; structural identity comes from position, explicit identity from .id(); changing the id resets state and forces a new view.
Copy-on-write and implementing it for a custom struct
CoW shares a buffer until mutation, deep-copying only when the buffer is non-unique; Array, Dictionary, Set, String use it; implement with a class storage box and isKnownUniquelyReferenced.
map versus compactMap versus flatMap
Map transforms each element one-to-one; compactMap transforms then drops nils; flatMap transforms to sequences then concatenates.
Debugging a closure capture leak in a third-party library
Use the Memory Graph Debugger to inspect retain paths, the Leaks and Allocations instruments, and malloc stack logging; trace the cycle before patching.
Verifying and avoiding copy-on-write overhead
Confirm extra copies via isKnownUniquelyReferenced or instruments and the retain trace; ensure unique references, mutate inout/in place, reserveCapacity, avoid aliasing.
The dynamic keyword and message dispatch
Dynamic forces Objective-C message dispatch via objc_msgSend, enabling KVO and swizzling, at the cost of skipping inlining and devirtualization.
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.
Diagnosing choppy scrolling performance
Reach for Instruments, especially the Time Profiler and Core Animation/Hangs tools, and look for main-thread work and dropped frames.
Purpose and setup of an Objective-C bridging header
The bridging header imports ObjC headers into Swift; Xcode auto-creates it or you add it manually and set the build setting.
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.
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.
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.
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.
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