INNER CODE UNIT · Swift

showCreditsAction

mjrusso/scoot · Scoot/AboutView.swift:50

    func showCreditsAction() {
        OSLog.main.log("Showing credits window.")
        openWindow(rootView: CreditsView(), title: "\(Bundle.main.displayName!) Credits")
    }

    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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…