1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +05:30
yattee/Shared/Views/OpenSettingsButton.swift
2021-10-18 01:29:03 +02:00

28 lines
705 B
Swift

import SwiftUI
struct OpenSettingsButton: View {
@Environment(\.dismiss) private var dismiss
@EnvironmentObject<NavigationModel> private var navigation
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()
}
}