@@ -10,11 +10,8 @@ A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize
1010- [ Usage] ( #usage )
1111- [ View Modifiers] ( #view-modifiers )
1212 - [ ` rest ` ] ( #rest )
13- - [ ` width ` ] ( #width )
14- - [ ` alignment ` ] ( #alignment )
1513 - [ ` impact ` ] ( #impact )
1614 - [ ` spring ` ] ( #spring )
17- - [ ` locked ` ] ( #locked )
1815 - [ ` onRest ` ] ( #onrest )
1916 - [ ` onLayoutForSizeClass ` ] ( #onlayoutforsizeclass )
2017- [ Example 1] ( #example-1 )
@@ -55,7 +52,6 @@ Following SwiftUI's declarative syntax, these view modifiers return a modified D
5552
5653Sets the active possible resting heights of the drawer.
5754
58-
5955** Usage**
6056Set a spring distance
6157``` swift
@@ -64,41 +60,6 @@ Drawer {
6460}.rest (at : $heights)
6561```
6662
67- ### Width
68-
69- #### 📏 ` width(_: Binding<CGFloat?>) -> Drawer `
70-
71- Defines a width for the drawer when not in fullscreen alignment.
72-
73- ** Usage**
74- ``` swift
75- Drawer (heights : [100 , 340 ]) {
76- Color.blue
77- }.width (.constant (340 ))
78- ```
79-
80- ### Alignment
81-
82- #### 📐 ` alignment(_: Binding<DrawerAlignment>) -> Drawer `
83-
84- Defines the horizontal alignment for the drawer. Default is fullscreen.
85-
86- ** Alignment**
87- ``` swift
88- public enum DrawerAlignment {
89- case leading , center , trailing , fullscreen
90- }
91- ```
92-
93- ** Usage**
94- ``` swift
95- Drawer (heights : [100 , 340 ]) {
96- Color.blue
97- }
98- .width (.constant (340 ))
99- .alignment ($alignment)
100- ```
101-
10263### Impact
10364
10465#### 💥 ` impact(_: UIImpactFeedbackGenerator.FeedbackStyle) -> Drawer `
@@ -164,37 +125,6 @@ Drawer(heights: [100, 340]) {
164125}.spring (isSpringy ? 0 : 20 )
165126```
166127
167- ### Locked
168-
169- #### 🔒 ` locked(_: Binding<Bool>, to height: @escaping (_ restingHeight: CGFloat) -> CGFloat) -> Drawer `
170-
171- Locks the drawer in a controlled position. When set to true, the drawer will animate into the locked height.
172-
173- ** isLocked**
174- A Binding Bool indicating if the drawer should be locked.
175-
176- ** height**
177- A closure returning the height to lock the drawer. The closure's argument is the drawer's current resting height.
178-
179- ** Usage**
180- Lock into a fixed position.
181- ``` swift
182- Drawer (heights : [100 , 340 ]) {
183- Color.blue
184- }.locked ($locked) {_ in
185- return 30
186- }
187- ```
188-
189- Lock into the current resting height
190- ``` swift
191- Drawer (heights : [100 , 340 ]) {
192- Color.blue
193- }.locked ($locked) { (current) in
194- return current
195- }
196- ```
197-
198128### OnRest
199129
200130#### 😴 ` onRest(_: @escaping (_ height: CGFloat) -> ()) -> Drawer `
@@ -231,32 +161,26 @@ Drawer(heights: [100, 340]) {
231161 Color.blue
232162}
233163.rest (at : $heights)
234- .width (.constant (340 ))
235- .alignment ($alignment)
236164.onLayoutForSizeClass { (sizeClass) in
237165 switch (sizeClass.horizontal , sizeClass.vertical ) {
238166 case (.compact , .compact ):
239167 // smaller iPhone landscape
240168 self .heights = [100 , UIScreen.main .bounds .height - 40 ]
241- self .alignment = .trailing
242169 break
243170 case (.compact , .regular ):
244171 // iPhone portrait
245172 // iPad portrait splitview
246173 // iPad landscape smaller splitview
247174 self .heights = [100 , 340 , UIScreen.main .bounds .height - 40 ]
248- self .alignment = .fullscreen
249175 break
250176 case (.regular , .compact ):
251177 // larger iPhone landscape
252178 self .heights = [100 , UIScreen.main .bounds .height - 40 ]
253- self .alignment = .trailing
254179 break
255180 case (.regular , .regular ):
256181 // iPad fullscreen
257182 // iPad landscape larger splitview
258183 self .heights = [100 , UIScreen.main .bounds .height - 40 ]
259- self .alignment = .trailing
260184 break
261185 default :
262186 // Unknown layout
0 commit comments