美文网首页
SwiftUI macos开发 程序最小化后点击dock栏无法还

SwiftUI macos开发 程序最小化后点击dock栏无法还

作者: zhcnnet | 来源:发表于2021-11-18 17:27 被阅读0次

    转自https://github.com/writefreely/writefreely-swiftui-multiplatform

    func applicationDidBecomeActive(_ notification: Notification) {
        
        if let window = NSApp.windows.first {
            window.deminiaturize(nil)
        }
    }
    
    func applicationDidChangeOcclusionState(_ notification: Notification) {
        
        if let window = NSApp.windows.first, window.isMiniaturized {
            NSWorkspace.shared.runningApplications.first(where: {
                $0.activationPolicy == .regular
            })?.activate(options: .activateAllWindows)
        }
    }
    
    

    相关文章

      网友评论

          本文标题:SwiftUI macos开发 程序最小化后点击dock栏无法还

          本文链接:https://www.haomeiwen.com/subject/yifjtrtx.html