|
2 | 2 |
|
3 | 3 | An iOS-16-styled slider.
|
4 | 4 |
|
5 |
| -Available on iOS 13 and later. |
| 5 | +Available on iOS 13 and later. Supports RTL. |
6 | 6 |
|
7 | 7 | https://user-images.githubusercontent.com/12840982/194141815-8c48bb74-e792-4d92-b43f-919c4834b2d8.mov
|
8 | 8 |
|
@@ -63,6 +63,45 @@ Slyder()
|
63 | 63 |
|
64 | 64 |
|
65 | 65 |
|
| 66 | + |
| 67 | + |
| 68 | +### Parameters of the default slider |
| 69 | + |
| 70 | +Slyderin uses `Slyderin.ThumblessSlider` by default. You can change its initializer's parameters to more-or-less do some customizations: |
| 71 | + |
| 72 | +```Swift |
| 73 | +Slyder( |
| 74 | + slider: ThumblessSlider( |
| 75 | + direction: .bottomToTop, |
| 76 | + scaleRatio: ThumblessSlider.ScaleRatio(ratioOnAxis: 1.05, ratioAgainstAxis: 1.15), |
| 77 | + cornerRadius: .fixed(12), |
| 78 | + visualEffect: UIBlurEffect(style: .systemMaterialDark) |
| 79 | + ) |
| 80 | +) |
| 81 | +``` |
| 82 | + |
| 83 | +- `direction` determines how whether the slider is horizontal or vertical and which way the track is filled, e.g.,: |
| 84 | + |
| 85 | + - `leadingToTrailing`. The slider is horizontal and the track is filled from the leading side to the trailing side when the user slides in leading-to-trailing direction. This is the default direction. |
| 86 | + - `bottomToTop`. The slider is vertical and the track is filled from bottom to top when the user slides upwards. |
| 87 | + |
| 88 | +- `scaleRatio`. The slider expands its size when responding to user inputs. This parameter specifies the expanding ratio. |
| 89 | + |
| 90 | + - If you set it to `ScaleRatio(ratioOnAxis: 1.05, ratioAgainstAxis: 1.15)`, for a horizontal slider, its 1.05 times wider and 1.15 times higher. Defaults to (1, 1). |
| 91 | + |
| 92 | + - > Versions <= 0.0.2 has a default value of `ScaleRatio(ratioOnAxis: 1, ratioAgainstAxis: 1)`. |
| 93 | +
|
| 94 | +- `cornerRadius` provides 2 different modes of corner radius: |
| 95 | + |
| 96 | + - `full`, the corner radius equals half the length against the `direction`'s axis. For a horizontal slider with a height of 20px, the corner radius is 10px. |
| 97 | + - `fixed(CGFloat)`, a fixed corner radius. |
| 98 | + |
| 99 | +- `visualEffect` specifies the visual effect of the unfilled track. |
| 100 | + |
| 101 | +> There is a new animation parameter on the way. |
| 102 | +
|
| 103 | + |
| 104 | + |
66 | 105 | ### About Tracking Modes
|
67 | 106 |
|
68 | 107 | `Slyder` supports 2 different modes of tracking. Specify it when initializing:
|
@@ -101,37 +140,6 @@ init(slider: Slidable = DefaultSlider(), options: [Option] = [])
|
101 | 140 |
|
102 | 141 |
|
103 | 142 |
|
104 |
| -### Parameters of the default slider |
105 |
| - |
106 |
| -Slyderin uses `Slyderin.ThumblessSlider` by default. You can change its initializer's parameters to more-or-less do some customizations: |
107 |
| - |
108 |
| -```Swift |
109 |
| -Slyder( |
110 |
| - slider: ThumblessSlider( |
111 |
| - direction: .bottomToTop, |
112 |
| - scaleRatio: ThumblessSlider.ScaleRatio(ratioOnAxis: 1.05, ratioAgainstAxis: 1.15), |
113 |
| - cornerRadius: .fixed(12), |
114 |
| - visualEffect: UIBlurEffect(style: .systemMaterialDark) |
115 |
| - ) |
116 |
| -) |
117 |
| -``` |
118 |
| - |
119 |
| -- `direction` determines how whether the slider is horizontal or vertical and which way the track is filled, e.g.,: |
120 |
| - - `leadingToTrailing`. The slider is horizontal and the track is filled from the leading side to the trailing side when the user slides in leading-to-trailing direction. This is the default direction. |
121 |
| - - `bottomToTop`. The slider is vertical and the track is filled from bottom to top when the user slides upwards. |
122 |
| -- `scaleRatio`. The slider expands its size when responding to user inputs. This parameter specifies the expanding ratio. |
123 |
| - - Defaults to 1.05 on the axis of the direction, and 2.0 against the axis. Which, for a horizontal slider, its width expands 1.05 times and its height becomes 2.0 times. |
124 |
| -- `cornerRadius` provides 2 different modes of corner radius: |
125 |
| - - `full`, the corner radius equals half the length against the `direction`'s axis. For a horizontal slider with a height of 20px, the corner radius is 10px. |
126 |
| - - `fixed(CGFloat)`, a fixed corner radius. |
127 |
| -- `visualEffect` specifies the visual effect of the unfilled track. |
128 |
| - |
129 |
| - |
130 |
| - |
131 |
| -There is an animation parameter on the way. |
132 |
| - |
133 |
| - |
134 |
| - |
135 | 143 | ### A built-in `UISlider`
|
136 | 144 |
|
137 | 145 | There is also a built-in `UISlider` subclass: `Slyderin.UIKitSlider`, which, unfortunately, supports only the leading-to-trailing direction:
|
|
0 commit comments