Here’s a quick-start iOS app lifecycle example for an iOS 13+ app: ```swift import UIKit import BackgroundTasks @main final class AppDelegate: UIResponder, UIApplicationDelegate { private let bootstrapper = AppBootstrapper() func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil ) -> Bool { bootstrapper.configureAppServices() BackgroundTaskManager.shared.register() return true } } final class SceneDelegate: UIR...
Scanned 9/5/2026
Install to Claude Code
npx -y skills add HoangNguyen0403/agent-skills-standard --skill ios-app-lifecycle --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Ios App Lifecycle?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-ios-app-lifecycle-1c2d2f2b)More formats (shields.io, HTML) on the badges page.
Here’s a quick-start iOS app lifecycle example for an iOS 13+ app:
```swift
import UIKit
import BackgroundTasks
@main
final class AppDelegate: UIResponder, UIApplicationDelegate {
private let bootstrapper = AppBootstrapper()
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
bootstrapper.configureAppServices()
BackgroundTaskManager.shared.register()
return true
}
}
final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
private let appCoordinator = AppCoordinator()
func scene(
_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions
) {
guard let windowScene = scene as? UIWindowScene else { return }
let window = UIWindow(windowScene: windowScene)
appCoordinator.start(in: window)
self.window = window
window.makeKeyAndVisible()
if let userActivity = connectionOptions.userActivities.first {
self.scene(scene, continue: userActivity)
}
}
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL else { return }
appCoordinator.handleUniversalLink(url)
}
}
final class AppBootstrapper {
func configureAppServices() {
// analytics, dependency injection, push registration
}
}
final class AppCoordinator {
func start(in window: UIWindow) {
window.rootViewController = UINavigationController(rootViewController: HomeViewController())
}
func handleUniversalLink(_ url: URL) {
// route link into the correct feature flow
}
}
final class BackgroundTaskManager {
static let shared = BackgroundTaskManager()
private let refreshTaskId = "com.example.app.refresh"
func register() {
BGTaskScheduler.shared.register(forTaskWithIdentifier: refreshTaskId, using: nil) { task in
self.handleRefresh(task: task as! BGAppRefreshTask)
}
}
func scheduleRefresh() {
let request = BGAppRefreshTaskRequest(identifier: refreshTaskId)
request.earliestBeginDate = Date(timeIntervalSinceNow: 15 * 60)
try? BGTaskScheduler.shared.submit(request)
}
private func handleRefresh(task: BGAppRefreshTask) {
scheduleRefresh()
task.expirationHandler = {
// cancel work before the system terminates the task
}
Task {
await refreshData()
task.setTaskCompleted(success: true)
}
}
private func refreshData() async {
// fetch updates in background
}
}
```
Quick rules:
- Keep `AppDelegate` slim for app-wide setup only.
- Use `SceneDelegate` to create the window on iOS 13+.
- Prefer Universal Links and handle them via `scene(_:continue:)`.
- Use `BGTaskScheduler` for background refresh and always set an `expirationHandler`.
- Avoid blocking launch with synchronous network calls.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!