iOS Platform & SwiftUI (50 Qs)•Part 3: Instruments Profiling, App Architecture & Production Hardening (25 - 35)
iOS Modular Architecture: Frameworks vs Swift Packages and Dynamic vs Static Linking.
senior LevelPerformanceSystem Design
In Simple Words:
- Static Linking (
.a/ Static Framework): Code is copied directly into the main app executable at compile time.- Faster app launch time (zero
dylddynamic loader overhead). - Slightly larger binary size if code is duplicated across extensions.
- Faster app launch time (zero
- Dynamic Linking (
.dylib/ Dynamic Framework): Linked at runtime bydyld.- Can be shared between the main app and app extensions (Widget, Watch app).
- Having $> 10$ dynamic frameworks degrades pre-main app launch time.