NewsBlur-viq/clients/ios/Classes/SceneDelegate.swift
David Sinclair c94e517a88 #1247 (Mac Catalyst edition)
- Moved globally-relevant methods to BaseViewController, so their menu items are always available.
- Big refactor to eliminate redundant appDelegate properties.
- Work in progress on reimplementing the navigation bars as a Mac toolbar.
2024-01-05 22:02:43 -05:00

37 lines
1,023 B
Swift

//
// SceneDelegate.swift
// NewsBlur
//
// Created by David Sinclair on 2023-11-15.
// Copyright © 2023 NewsBlur. All rights reserved.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
let appDelegate: NewsBlurAppDelegate = .shared
var window: UIWindow?
#if targetEnvironment(macCatalyst)
var toolbar = NSToolbar(identifier: "main")
var toolbarDelegate = ToolbarDelegate()
#endif
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
appDelegate.window = window
#if targetEnvironment(macCatalyst)
guard let windowScene = scene as? UIWindowScene, let titlebar = windowScene.titlebar else {
return
}
toolbar.delegate = toolbarDelegate
toolbar.displayMode = .iconOnly
titlebar.toolbar = toolbar
titlebar.toolbarStyle = .automatic
#endif
appDelegate.prepareViewControllers()
}
}