iOS
SwiftUI
UISceneDelegate
app development
Xcode

Opt out of UISceneDelegate/SwiftUI on iOS

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

Whether you can "opt out" depends on which lifecycle you are actually using. In a UIKit app, you can remove scene-based lifecycle support and fall back to AppDelegate-only behavior by removing the scene manifest. In a SwiftUI app that uses the @main App lifecycle, scenes are part of the framework model, so you are not really opting out of scenes in the same way.

UIKit: How to Disable UISceneDelegate

For a UIKit app, scene support is enabled through UIApplicationSceneManifest in Info.plist and, typically, a SceneDelegate class.

If you want old-style single-app lifecycle behavior:

  1. remove the scene manifest from Info.plist
  2. remove SceneDelegate.swift
  3. move window setup back into AppDelegate
  4. remove scene-session lifecycle methods if they are no longer needed

Typical AppDelegate window setup:

swift
1import UIKit
2
3@main
4class AppDelegate: UIResponder, UIApplicationDelegate {
5    var window: UIWindow?
6
7    func application(
8        _ application: UIApplication,
9        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
10    ) -> Bool {
11        let window = UIWindow(frame: UIScreen.main.bounds)
12        window.rootViewController = UIViewController()
13        window.makeKeyAndVisible()
14        self.window = window
15        return true
16    }
17}

That is the classic non-scene lifecycle.

This is mostly relevant for older UIKit-style apps or single-window apps that do not need scene support on modern iPadOS features.

SwiftUI: Scenes Are Built In

A SwiftUI app created with:

swift
1@main
2struct MyApp: App {
3    var body: some Scene {
4        WindowGroup {
5            ContentView()
6        }
7    }
8}

is already using SwiftUI's scene model. There is no separate UISceneDelegate file, but the app is still scene-based through WindowGroup and related scene types.

So if your question is "How do I use SwiftUI but avoid UISceneDelegate?" the answer is: SwiftUI already avoids the explicit delegate class, but it does not abandon the scene concept.

Mixing AppDelegate With SwiftUI

If you need traditional app-level hooks while still using SwiftUI views, attach an app delegate adapter:

swift
1import SwiftUI
2
3class AppDelegate: NSObject, UIApplicationDelegate {
4    func application(
5        _ application: UIApplication,
6        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
7    ) -> Bool {
8        print("App launched")
9        return true
10    }
11}
12
13@main
14struct MyApp: App {
15    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
16
17    var body: some Scene {
18        WindowGroup {
19            ContentView()
20        }
21    }
22}

This is usually the right approach if you want SwiftUI plus some UIApplicationDelegate behavior.

When You Truly Need the Old Lifecycle

If you need a fully non-scene app lifecycle, stay with a UIKit app entry point and remove the scene manifest. That is a UIKit choice, not a SwiftUI App lifecycle choice.

Trying to force a SwiftUI App into a non-scene model usually means fighting the framework instead of using it as designed.

If the real goal is just to regain one or two app-level hooks, @UIApplicationDelegateAdaptor is usually enough and is much less disruptive than rewriting the app entry point.

Common Pitfalls

The biggest mistake is thinking that removing SceneDelegate.swift from a SwiftUI app means scenes are gone. They are still there through WindowGroup.

Another mistake is deleting the scene manifest from a UIKit project without moving window setup back into AppDelegate, leaving the app with no visible root view controller.

A third issue is mixing SwiftUI lifecycle expectations with UIKit lifecycle code without being clear about which entry point owns the window.

Summary

  • In UIKit, you can opt out of UISceneDelegate by removing the scene manifest and using AppDelegate-managed windows.
  • In SwiftUI's App lifecycle, scenes are part of the model even without an explicit SceneDelegate class.
  • Use @UIApplicationDelegateAdaptor if you want SwiftUI plus app-delegate hooks.
  • If you truly need a non-scene lifecycle, use the classic UIKit app model.
  • Be clear about which entry point owns the app window and lifecycle.

Course illustration
Course illustration

All Rights Reserved.