Remove outdated version checks

This commit is contained in:
Daniel Chick 2024-03-11 21:51:35 -05:00
parent f62c5139f0
commit 4394c48e11
3 changed files with 11 additions and 31 deletions

View file

@ -20,29 +20,17 @@ struct NavigationSplitViewWrapper<Sidebar, Detail>: View where Sidebar: View, De
}
var body: some View {
if #available(iOS 16, macOS 13, tvOS 16, watchOS 9, visionOS 1, *) {
// Use the latest API available
NavigationSplitView {
if #available(macOS 14, *) {
sidebar
.navigationSplitViewColumnWidth(min: 250, ideal: 300)
} else {
sidebar
}
} detail: {
detail
}
.navigationSplitViewStyle(.balanced)
} else {
// Alternative code for earlier versions of OS.
NavigationView {
// The first column is the sidebar.
// Use the latest API available
NavigationSplitView {
if #available(macOS 14, *) {
sidebar
.navigationSplitViewColumnWidth(min: 250, ideal: 300)
} else {
sidebar
.frame(minWidth: 250)
detail
}
.navigationViewStyle(.columns)
} detail: {
detail
}
.navigationSplitViewStyle(.balanced)
}
}

View file

@ -55,11 +55,7 @@ struct MainWindow: View {
.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)
}
NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil)
}, label: {
Label("Preferences", systemImage: "gearshape")
})

View file

@ -169,9 +169,5 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
func localizeString(_ key: String, comment: String = "") -> String {
if #available(macOS 12, *) {
return String(localized: String.LocalizationValue(key))
} else {
return NSLocalizedString(key, comment: comment)
}
return String(localized: String.LocalizationValue(key))
}