Skip to content

Commit 122e114

Browse files
committed
Adjust UI to show the modes.
1 parent a3b13f8 commit 122e114

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

Shared/Samples/Show realistic light and shadows/ShowRealisticLightAndShadowsView.swift

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,30 @@ struct ShowRealisticLightAndShadowsView: View {
5151
}
5252
.frame(maxWidth: 540)
5353
.onChange(of: dateSecond, perform: sliderValueChanged(toValue:))
54-
.padding()
54+
.padding(.horizontal)
55+
}
56+
.overlay(alignment: .top) {
57+
dateTimeOverlay
5558
}
5659
.toolbar {
57-
ToolbarItemGroup(placement: .bottomBar) {
58-
Text(dateTimeText)
59-
60-
Menu("Mode") {
61-
Picker("Choose a lighting mode for the scene view.", selection: $lightingMode) {
62-
ForEach(SceneView.SunLighting.allCases, id: \.self) { mode in
63-
Text(mode.label)
64-
}
60+
ToolbarItem(placement: .bottomBar) {
61+
Picker("Choose a lighting mode for the scene view.", selection: $lightingMode) {
62+
ForEach(SceneView.SunLighting.allCases, id: \.self) { mode in
63+
Text(mode.label)
6564
}
6665
}
6766
}
6867
}
6968
}
7069

70+
/// An overlay showing the date time adjusted by the slider.
71+
var dateTimeOverlay: some View {
72+
Text(dateTimeText)
73+
.frame(maxWidth: .infinity)
74+
.padding(.vertical, 6)
75+
.background(.thinMaterial, ignoresSafeAreaEdges: .horizontal)
76+
}
77+
7178
/// Handles slider value changed event and set the scene view's sun date.
7279
/// - Parameter value: The slider's value.
7380
private func sliderValueChanged(toValue value: Float) {

0 commit comments

Comments
 (0)