1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 22:30:32 +05:30
yattee/Shared/Views/OpenSettingsButton.swift

31 lines
740 B
Swift
Raw Normal View History

2021-10-18 04:36:00 +05:30
import SwiftUI
struct OpenSettingsButton: View {
@Environment(\.dismiss) private var dismiss
2021-11-11 03:35:59 +05:30
#if !os(macOS)
@EnvironmentObject<NavigationModel> private var navigation
#endif
2021-10-18 04:36:00 +05:30
var body: some View {
Button {
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(.borderedProminent)
}
}
struct OpenSettingsButton_Previews: PreviewProvider {
static var previews: some View {
OpenSettingsButton()
}
}