Skip to content

Commit

Permalink
Add close button to setting sheet for visionOS (#2025)
Browse files Browse the repository at this point in the history
* Add close button

* Limit to visionos and switch to dismiss
  • Loading branch information
pjleonard37 authored Feb 14, 2024
1 parent 65493ff commit c00860c
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ struct Settings {
var mapStyle: MapStyle = .standard
var orientation: NorthOrientation = .upwards
var gestureOptions: GestureOptions = .init()
var cameraBounds: CameraBoundsOptions = .init()
var cameraBounds: CameraBoundsOptions = .world
var constrainMode: ConstrainMode = .heightOnly
var ornamentSettings = OrnamentSettings()
var debugOptions: MapViewDebugOptions = [.camera]
Expand Down Expand Up @@ -85,6 +85,10 @@ struct MapSettingsExample : View {
@available(iOS 14.0, *)
struct SettingsView : View {
@Binding var settings: Settings
#if os(visionOS)
@Environment(\.dismiss) private var dismiss
#endif

var body: some View {
Form {
Section {
Expand Down Expand Up @@ -162,6 +166,11 @@ struct SettingsView : View {
} header: {
Text("Performance Statistics")
}
#if os(visionOS)
Button("Close Settings") {
dismiss()
}
#endif
}
}
}
Expand Down

0 comments on commit c00860c

Please sign in to comment.