Lecturer: Ali Najimi Faculty of Computer Engineering Sharif University of Technology Fall 2027
iOS Architecture Lifecycle Sandbox IPA
iOS is a layered architecture of software components. Understanding this stack is crucial.
Key Takeaway: Your app sits at the top, but it relies heavily on the layers below — from SwiftUI down to the kernel.
The foundation. Darwin is Apple's open-source OS, built on the XNU kernel (X is Not Unix).
Note: iOS does not use the standard macOS kernel exactly; it has a restricted kernel (no root access, no dynamic library loading after boot) specifically hardened for mobile.
The lowest-level APIs, built on top of Darwin. These are the building blocks that everything else depends on.
Provides fundamental services that support both apps and the frameworks above.
The primary UI and interaction framework for iOS apps. UIKit is the backbone.
UIApplication
BGTaskScheduler
Where the user interacts.
~/Library/
~/Documents/
~/tmp/
Info.plist is the metadata file for your app. Without it, iOS doesn't know how to launch or configure your app.
Info.plist
Key Roles:
edu.sharif.mp
UILaunchStoryboardName
UIApplicationSceneManifest
myscheme://
An IPA (iOS App Store Package) is a ZIP file containing the app and its resources.
MyApp.app/
MyApp
Frameworks/
PlugIns/
Assets.xcassets/
Base.lproj/
Payload/MyApp.app/_CodeSignature/CodeResources
The View Controller Lifecycle is the most critical concept. If you get this wrong, your UI won't update properly.
Appearing States
Disappearing States
Why did my app lose its state?
didReceiveMemoryWarning
viewDidLoad
UserDefaults
SQLite
Core Data
Golden Rule: Do not trust that your in-memory state survives a background termination.
Objective: Create a simple app that logs lifecycle events.
viewWillAppear
viewDidAppear
viewWillDisappear
viewDidDisappear
AVAudioSession
playback
// Swift implementation AVAudioSession.sharedInstance().setCategory(.playback, mode: .default) AVAudioSession.sharedInstance().setActive(true)
"A Swift developer walks into a bar. The bartender says, 'Sorry, we don't serve your thread here.' The developer replies, 'It's okay, I'll just dispatch_async to the main queue.'"