Skip to content

Commit 8c729fd

Browse files
committed
Edit Readme
1 parent 66a5825 commit 8c729fd

File tree

1 file changed

+74
-6
lines changed

1 file changed

+74
-6
lines changed

README.md

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ A SwiftUI library to present a Pill Picker view
2121

2222
<br>
2323

24-
## Installation
24+
## 📀 Installation
2525
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/).
2626

2727
<table>
@@ -62,7 +62,7 @@ pod 'PillPickerView'
6262

6363
<br>
6464

65-
## Usage
65+
## 🧑‍💻 Usage
6666

6767
Creating a PillPickerView
6868

@@ -113,16 +113,84 @@ struct ContentView: View {
113113

114114
In the example above, replace YourPillType with your custom pill type and yourItemList with an array of items conforming to the Pill protocol.
115115

116-
## Customization
116+
## Customization
117117

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:
119121

120122
```swift
123+
PillPickerView(
124+
items: yourItemList,
125+
selectedPills: $selectedPills
126+
)
121127
.pillFont(.system(size: 16, weight: .semibold))
122128
.pillSelectedForegroundColor(.white)
123129
.pillSelectedBackgroundColor(.blue)
124130
```
125131

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:
127195

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

Comments
 (0)