Merge pull request #444 from XcodesOrg/matt/SettingsLinkSonoma

fix: settings link on Sonoma not working
This commit is contained in:
Matt Kiazyk 2023-11-22 08:49:27 -06:00 committed by GitHub
commit 5b18a90f81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 12 deletions

View file

@ -8,10 +8,10 @@ on:
jobs:
test:
runs-on: macos-12
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Run tests
env:
DEVELOPER_DIR: /Applications/Xcode_14.2.app
DEVELOPER_DIR: /Applications/Xcode_15.0.1.app
run: xcodebuild test -scheme Xcodes

View file

@ -86,16 +86,23 @@ struct MainToolbarModifier: ViewModifier {
.keyboardShortcut(KeyboardShortcut("i", modifiers: [.command, .option]))
.help("InfoDescription")
Button(action: {
if #available(macOS 13, *) {
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
} else {
NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil)
}
}, label: {
Label("Preferences", systemImage: "gearshape")
})
.help("PreferencesDescription")
if #available(macOS 14, *) {
SettingsLink(label: {
Label("Preferences", systemImage: "gearshape")
})
.help("PreferencesDescription")
} else {
Button(action: {
if #available(macOS 13, *) {
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
} else {
NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil)
}
}, label: {
Label("Preferences", systemImage: "gearshape")
})
.help("PreferencesDescription")
}
TextField("Search", text: $searchText)
.textFieldStyle(RoundedBorderTextFieldStyle())