1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 14:20:32 +05:30
yattee/Shared/Views/OpenSettingsButton.swift
2023-07-24 19:45:30 +02:00

32 lines
810 B
Swift

import SwiftUI
struct OpenSettingsButton: View {
@Environment(\.presentationMode) private var presentationMode
#if !os(macOS)
private var navigation: NavigationModel { .shared }
#endif
var body: some View {
Button {
presentationMode.wrappedValue.dismiss()
#if os(macOS)
NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil)
#else
navigation.presentingSettings = true
#endif
} label: {
Label("Open Settings", systemImage: "gearshape.2")
}
.buttonStyle(.plain)
.buttonStyle(.borderedProminent)
}
}
struct OpenSettingsButton_Previews: PreviewProvider {
static var previews: some View {
OpenSettingsButton()
}
}