INNER CODE UNIT · Swift
showLicenseAction
mjrusso/scoot · Scoot/AboutView.swift:55
func showLicenseAction() {
OSLog.main.log("Showing license window.")
openWindow(rootView: LicenseView(), title: "\(Bundle.main.displayName!) License")
}
func openWindow<Content>(rootView: Content, title: String) where Content : View {
let hostingController = NSHostingController(rootView: rootView)
let window = NSWindow(contentViewController: hostingController)
window.styleMask = [.closable, .titled]
window.titlebarAppearsTransparent = true
window.title = title
let controller = NSWindowController(window: window)
controller.showWindow(self)
}