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
@@ -124,8 +138,12 @@ In the example above, replace YourPillType with your custom pill type and yourIt
124
138
125
139
PillPickerView offers a range of customization options to tailor the appearance of the pills to your app's design. You can customize the font, colors, animation, size, and other visual aspects of the pills by using the available modifier functions.
126
140
141
+
The PillPickerView includes a wrapping mechanism that automatically adjusts the layout of pills to fit within the available space. If the pills exceed the horizontal width of the container, the view wraps the excess pills to a new line. This makes it easy to present a large number of pills without worrying about truncation.
142
+
127
143
You can customize the appearance of the pills by chaining the available modifier functions on the PillPickerView. For example:
128
144
145
+
<br>
146
+
129
147
```swift
130
148
PillPickerView(
131
149
items: yourItemList,
@@ -138,6 +156,22 @@ PillPickerView(
138
156
139
157
<br>
140
158
159
+
To switch between the underlying stack style for the content. Choosing `.noWrap` will invariably cause any text inside the pills to be truncated depending on length, as it will automatically be fitted inside the view and not wrap to a new line. Choosing `.wrap` will let the pills be dynamically placed an move in the PillPickerView.
160
+
161
+
```swift
162
+
.pillStackStyle(.noWrap) // Prevents pills from wrapping to a new line and being dynamic
163
+
.pillStackStyle(.wrap) // Default value. Allows pills to move in container
164
+
```
165
+
166
+
<br>
167
+
168
+
To modify the vertical or horizontal spacing in the PillPickerView
169
+
170
+
```swift
171
+
.pillViewVerticalSpacing(10)
172
+
.pillViewHorizontalSpacing(5)
173
+
```
174
+
141
175
To change the font of the pills
142
176
143
177
```swift
@@ -146,6 +180,24 @@ To change the font of the pills
146
180
147
181
<br>
148
182
183
+
You can of course chain things together to get a good layout based on your circumstances and requirements.
184
+
185
+
```swift
186
+
.pillFont(.title3)
187
+
.pillViewHorizontalSpacing(30)
188
+
```
189
+
190
+
<br>
191
+
192
+
To change the icon used by each pill when it is 'selected'.
193
+
I advise you to choose something that indicates that the pill will no longer be selected if this icon is pressed, as this is the intended behavior.
194
+
195
+
```swift
196
+
.pillSelectedIcon(Image(systemName: "xmark"))
197
+
```
198
+
199
+
<br>
200
+
149
201
To change the background color of a not selected and selected pill, respectively
150
202
151
203
```swift
@@ -195,9 +247,3 @@ Padding can also be applied
195
247
```swift
196
248
.pillPadding(10)
197
249
```
198
-
199
-
<br>
200
-
201
-
## Note:
202
-
203
-
The PillPickerView includes a wrapping mechanism that automatically adjusts the layout of pills to fit within the available space. If the pills exceed the horizontal width of the container, the view wraps the excess pills to a new line. This makes it easy to present a large number of pills without worrying about truncation.
0 commit comments