INNER CODE UNIT · Swift

openWindow

mjrusso/scoot · Scoot/AboutView.swift:60

    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)
    }

}

struct AboutView_Previews: PreviewProvider {
    static var previews: some View {
        AboutView()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…