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
+74-6Lines changed: 74 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ A SwiftUI library to present a Pill Picker view
21
21
22
22
<br>
23
23
24
-
## Installation
24
+
## 📀 Installation
25
25
Requires iOS 14+. PillPickerView can be installed through the [Swift Package Manager](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app) (recommended) or [Cocoapods](https://cocoapods.org/).
26
26
27
27
<table>
@@ -62,7 +62,7 @@ pod 'PillPickerView'
62
62
63
63
<br>
64
64
65
-
## Usage
65
+
## 🧑💻 Usage
66
66
67
67
Creating a PillPickerView
68
68
@@ -113,16 +113,84 @@ struct ContentView: View {
113
113
114
114
In the example above, replace YourPillType with your custom pill type and yourItemList with an array of items conforming to the Pill protocol.
115
115
116
-
## Customization
116
+
## ✨ Customization
117
117
118
-
Customize the appearance of the pill picker by chaining the available modifier functions. For example:
118
+
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.
119
+
120
+
You can customize the appearance of the pills by chaining the available modifier functions on the PillPickerView. For example:
119
121
120
122
```swift
123
+
PillPickerView(
124
+
items: yourItemList,
125
+
selectedPills: $selectedPills
126
+
)
121
127
.pillFont(.system(size: 16, weight: .semibold))
122
128
.pillSelectedForegroundColor(.white)
123
129
.pillSelectedBackgroundColor(.blue)
124
130
```
125
131
126
-
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.
132
+
<br>
133
+
134
+
To change the font of the pills
135
+
136
+
```swift
137
+
.pillFont(.caption)
138
+
```
139
+
140
+
<br>
141
+
142
+
To change the background color of a not selected and selected pill, respectively
143
+
144
+
```swift
145
+
.pillNormalBackgroundColor(.green)
146
+
.pillSelectedBackgroundColor(.blue)
147
+
```
148
+
149
+
<br>
150
+
151
+
To change the foreground color of a not selected and selected pill, respectively
152
+
153
+
```swift
154
+
.pillNormalForegroundColor(.orange)
155
+
.pillSelectedForegroundColor(.white)
156
+
```
157
+
158
+
<br>
159
+
160
+
The height and width of the pills can also be set, but width will be treated as the minimum width of the pills
161
+
162
+
```swift
163
+
.pillWidth(20)
164
+
.pillHeight(10)
165
+
```
166
+
167
+
<br>
168
+
169
+
Corner radius and border color can also be changed easily
170
+
171
+
```swift
172
+
.pillBorderColor(.green)
173
+
.pillCornerRadius(40)
174
+
```
175
+
176
+
<br>
177
+
178
+
You can also change the animation used when a pill is pressed or wrapped to a newline
179
+
180
+
```swift
181
+
.pillAnimation(.easeInOut)
182
+
```
183
+
184
+
<br>
185
+
186
+
Padding can also be applied
187
+
188
+
```swift
189
+
.pillPadding(10)
190
+
```
191
+
192
+
<br>
193
+
194
+
## Note:
127
195
128
-
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. The automatic wrapping behavior ensures a visually pleasing and user-friendly experience for your app's pill picker interface.
196
+
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