Files
5GUIs-1/Sources/5GUIs/AppDelegate.swift
Helge Heß caa6434312 5 GUIs - initial drop
Ooh LA LA ...
2020-10-01 16:43:06 +02:00

44 lines
990 B
Swift

//
// AppDelegate.swift
// 5 GUIs
//
// Created by Helge Heß on 28.09.20.
//
import Cocoa
import SwiftUI
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) {
let window = makeAppWindow(ContentView())
window.makeKeyAndOrderFront(nil)
}
@IBAction func newDocument(_ sender: Any?) {
let window = makeAppWindow(ContentView())
window.makeKeyAndOrderFront(nil)
}
@IBAction func openDocument(_ sender: Any?) {
let panel = makeOpenPanel()
panel.begin { response in
guard response == .OK else { return }
for url in panel.urls {
let view = ContentView()
let window = makeAppWindow(view)
window.makeKeyAndOrderFront(nil)
view.loadURL(url)
}
}
}
private lazy var infoPanel = makeInfoPanel(InfoPanel())
@IBAction func showInfoPanel(_ sender: Any?) {
infoPanel.makeKeyAndOrderFront(nil)
}
}