forked from arthurhammer/FrameGrabber
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneDelegate.swift
More file actions
65 lines (53 loc) · 2.42 KB
/
SceneDelegate.swift
File metadata and controls
65 lines (53 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import UIKit
@MainActor
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
var coordinator: Coordinator?
let fileManager = FileManager.default
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = scene as? UIWindowScene else { return }
if window == nil {
window = UIWindow(windowScene: windowScene)
}
guard let window = window else { return }
if window.rootViewController == nil {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
guard let navigationController = storyboard.instantiateInitialViewController() as? UINavigationController else {
assertionFailure("Root view controller is not a UINavigationController")
return
}
window.rootViewController = navigationController
} else {
guard window.rootViewController is UINavigationController else {
assertionFailure("Root view controller is not a UINavigationController")
return
}
}
Style.configureAppearance(for: window)
if let navigationController = window.rootViewController as? UINavigationController {
coordinator = Coordinator(navigationController: navigationController)
coordinator?.start()
}
if connectionOptions.urlContexts.isEmpty {
try? fileManager.clearTemporaryDirectories()
}
window.makeKeyAndVisible()
}
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let context = URLContexts.first else { return }
let url = context.url
let openInPlace = context.options.openInPlace
// MARK: - UNUSED WARNING Removed 5.Nov.2025
// if let importedURL = try? fileManager.importFile(at: url, asCopy: true, deletingSource: !openInPlace),
// let coordinator = coordinator {
// coordinator.open(videoUrl: importedURL)
// }
if let importedURL = try? fileManager.importFile(at: url, asCopy: true, deletingSource: !openInPlace),
let coordinator = coordinator {
_ = coordinator.open(videoUrl: importedURL)
}
}
func sceneDidDisconnect(_ scene: UIScene) {
// No action needed here for clearing temporary directories.
}
}