Skip to content

Commit af280a5

Browse files
committed
Doc
1 parent 9ed84d9 commit af280a5

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Sources/ArcGISToolkit/Components/FloatingPanel/FloatingPanel.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ struct FloatingPanel<Content>: View where Content: View {
5252
/// The maximum allowed height of the content.
5353
@State private var maximumHeight: CGFloat = .zero
5454

55-
/// The detent that was the active detent until a FloatingPanelDetentPreference was set.
55+
/// Stores the detent that was active before a `FloatingPanelDetent.Preference` was applied.
5656
///
57-
/// When the FloatingPanelDetentPreference is unset, this detent should be restored to the active detent..
57+
/// This value allows the panel to restore the previous state when the preference is cleared.
58+
/// It is only set when a new preference is first applied and cleared when the preference is removed.
5859
@State private var overriddenDetent: FloatingPanelDetent?
5960

6061
var body: some View {
@@ -71,18 +72,16 @@ struct FloatingPanel<Content>: View where Content: View {
7172
.clipped()
7273
.onPreferenceChange(FloatingPanelDetent.Preference.self) { preference in
7374
if let preference {
74-
// Only update the overridden detent if one
75-
// wasn't already saved. This prevents a
76-
// FloatingPanelDetentPreference from being
77-
// saved as the overridden detent.
75+
// Only set the overridden detent if it's `nil`.
76+
// This prevents a preference from being saved
77+
// as the overridden detent.
7878
if overriddenDetent == nil {
7979
overriddenDetent = activeDetent
8080
}
8181
activeDetent = preference
8282
} else if let overriddenDetent {
83-
// When the FloatingPanelDetentPreference is
84-
// unset, restore the overridden detent as the
85-
// active detent.
83+
// When the preference is unset, restore the
84+
// overridden detent as the active detent.
8685
activeDetent = overriddenDetent
8786
self.overriddenDetent = nil
8887
}

0 commit comments

Comments
 (0)