Skip to content
Back to skills

Ios App Lifecycle

ASecurity

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...

  • 584 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 5, 2026
developmentswift

Security analysis

A100/100

Pro scans all 12 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill ios-app-lifecycle --agent claude-code

Installs 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 with every re-scan.

Security grade badge for Ios App Lifecycle
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-ios-app-lifecycle-1c2d2f2b/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-ios-app-lifecycle-1c2d2f2b)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
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.

Files in this skill

  • eval-1.baseline.md1.8 KB
  • eval-1.with-skill.md1.9 KB
  • eval-2.baseline.md1.4 KB
  • eval-2.with-skill.md799 B
  • eval-3.baseline.md1.7 KB
  • eval-3.with-skill.md3.1 KB
  • trigger-1.md123 B
  • trigger-2.md164 B
  • trigger-3.md141 B
  • trigger-4.md148 B
  • trigger-5.md132 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.