You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-14Lines changed: 41 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -136,6 +136,8 @@ struct ContentView: View {
136
136
137
137
### Options
138
138
139
+
`.absolutePositionValue` Allows absolute values in pixels to be used as BottomSheetPosition values.
140
+
139
141
`.allowContentDrag` Allows the BottomSheet to move when dragging the mainContent.
140
142
141
143
- Do not use if the mainContent is packed into a ScrollView.
@@ -173,15 +175,15 @@ struct ContentView: View {
173
175
174
176
## Custom States
175
177
176
-
177
178
You can create your own custom BottomSheetPosition enum:
178
179
- The enum must be conforming to `CGFloat` and `CaseIterable`
179
180
- The case and enum name doesnt matter
180
181
- The case/state with `rawValue == 0` is hiding the BottomSheet
181
-
- The value can be anythig between `0` and `1` (`x <= 1`, `x >= 0`)
182
-
- The value is the height of the BottomSheet propotional to the screen height (`1 == 100% == full screen`)
182
+
- The value can be anythig between `0` and `1` (`x <= 1`, `x >= 0`) or anything above `0` (`x >= 0`) when using the`.absolutePositionValue` option
183
+
- The value is the height of the BottomSheet propotional to the screen height (`1 == 100% == full screen`) or the height of the BottomSheet in pixel (`1 == 1px`) when using the`.absolutePositionValue` option
183
184
- The lowest value (greater than 0) automaticly gets the `.bottom` behavior. To prevent this please use the option `.noBottomPosition`
**PLEASE NOTE:** When installed via Cocoapods, please keep in mind that the pod is called `BottomSheetSwiftUI` and not `BottomSheet`; so please use `import BottomSheetSwiftUI` instead.
This BottomSheet shows additional information about a book.
200
209
You can close it by swiping it away, by tapping on the background or the close button.
201
-
It also uses a custom `enum` for the states, since only the states `.middle`, `.bottom` and `.hidden` should exist.
210
+
The drag indicator is hidden.
211
+
It uses a custom `enum` for the states with absolute values, since only the states `.middle`, `.bottom` and `.hidden` should exist with a predefined absolute height.
let songs: [String] = ["One Dance (feat. Wizkid & Kyla)", "God's Plan", "SICKO MODE", "In My Feelings", "Work (feat. Drake)", "Nice For What", "Hotline Bling", "Too Good (feat. Rihanna)", "Life Is Good (feat. Drake)"]
The default BottomSheetPosition; it has the following cases and values: `top = 0.975`, `middle = 0.4`, `bottom = 0.125`, `hidden = 0`
11
+
The default BottomSheetPosition; it has the following cases and values: `top = 0.975`, `middle = 0.4`, `bottom = 0.125`, `hidden = 0`.
12
+
13
+
This BottomSheetPosition uses relative values. For absolute values in pixels, see BottomSheetPositionAbsolute.
12
14
13
15
You can create your own custom BottomSheetPosition enum:
14
16
- The enum must be conforming to `CGFloat` and `CaseIterable`
15
17
- The case and enum name doesnt matter
16
18
- The case/state with `rawValue == 0` is hiding the BottomSheet
17
-
- The value can be anythig between `0` and `1` (`x <= 1`, `x >= 0`)
18
-
- The value is the height of the BottomSheet propotional to the screen height (`1 == 100% == full screen`)
19
+
- The value can be anythig between `0` and `1` (`x <= 1`, `x >= 0`) or anything above `0` (`x >= 0`) when using the`.absolutePositionValue` option
20
+
- The value is the height of the BottomSheet propotional to the screen height (`1 == 100% == full screen`) or the height of the BottomSheet in pixel (`1 == 1px`) when using the`.absolutePositionValue` option
19
21
- The lowest value (greater than 0) automaticly gets the `.bottom` behavior. To prevent this please use the option `.noBottomPosition`
//The state where the height of the BottomSheet is 97.5%
24
+
///The state where the height of the BottomSheet is 97.5%
23
25
case top =0.975
24
-
//The state where the height of the BottomSheet is 40%
26
+
///The state where the height of the BottomSheet is 40%
25
27
case middle =0.4
26
-
//The state where the height of the BottomSheet is 12.5% and the `mainContent` is hidden
28
+
///The state where the height of the BottomSheet is 12.5% and the `mainContent` is hidden
27
29
case bottom =0.125
28
-
//The state where the BottomSheet is hidden
30
+
///The state where the BottomSheet is hidden
31
+
case hidden =0
32
+
}
33
+
34
+
/**
35
+
The default BottomSheetPositionAbsolute; it has the following cases and values: `top = 750`, `middle = 300`, `bottom = 100`, `hidden = 0`.
36
+
37
+
This BottomSheetPositionAbsolute uses absolute values and requires the the`.absolutePositionValue` option. For relative values in pixels, see BottomSheetPosition.
38
+
39
+
You can create your own custom BottomSheetPosition enum:
40
+
- The enum must be conforming to `CGFloat` and `CaseIterable`
41
+
- The case and enum name doesnt matter
42
+
- The case/state with `rawValue == 0` is hiding the BottomSheet
43
+
- The value can be anythig between `0` and `1` (`x <= 1`, `x >= 0`) or anything above `0` (`x >= 0`) when using the`.absolutePositionValue` option
44
+
- The value is the height of the BottomSheet propotional to the screen height (`1 == 100% == full screen`) or the height of the BottomSheet in pixel (`1 == 1px`) when using the`.absolutePositionValue` option
45
+
- The lowest value (greater than 0) automaticly gets the `.bottom` behavior. To prevent this please use the option `.noBottomPosition`
0 commit comments