Created
June 4, 2023 13:32
-
-
Save rainyskye/e53f59ba21ca5004ac755f16466856b0 to your computer and use it in GitHub Desktop.
Opening native app Settings/Preferences with SwiftUI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func openSettings() { | |
if #available(macOS 13, *) { | |
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil) | |
} else { | |
NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment