Skip to content

Commit cd98ac0

Browse files
committed
Update README
1 parent a113880 commit cd98ac0

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

README.md

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<a href="https://github.com/uias/Pageboy">
77
<img src="https://github.com/uias/Pageboy/workflows/Build/badge.svg" />
88
</a>
9-
<img src="https://img.shields.io/badge/Swift-5-orange?logo=Swift&logoColor=white" />
9+
<img src="https://img.shields.io/badge/Swift-6-orange?logo=Swift&logoColor=white" />
1010
<a href="https://github.com/uias/Pageboy/releases">
1111
<img src="https://img.shields.io/github/release/uias/Pageboy.svg" />
1212
</a>
@@ -15,57 +15,65 @@
1515
</a>
1616
</p>
1717

18-
**TL;DR** *UIPageViewController done properly.*
18+
**TL;DR** _UIPageViewController done properly._
1919

2020
## ⭐️ Features
21+
2122
- [x] Simplified data source management & enhanced delegation.
2223
- [x] Dynamically insert & remove pages.
2324
- [x] Infinite scrolling support.
2425
- [x] Automatic timer-based page transitioning.
2526
- [x] Support for custom animated page transitions.
2627

2728
## 📋 Requirements
28-
Pageboy requires iOS 12 / tvOS 12; and is compatible with Swift 5.
29+
30+
Pageboy requires iOS 12 / tvOS 12; and is compatible with Swift 5/6.
2931

3032
## 📲 Installation
3133

3234
### Swift Package Manager
35+
3336
Pageboy is compatible with [Swift Package Manager](https://swift.org/package-manager) and can be integrated via Xcode.
3437

3538
### CocoaPods
39+
3640
Pageboy is also available through [CocoaPods](https://cocoapods.org):
41+
3742
```ruby
3843
pod 'Pageboy', '~> 4.2'
3944
```
4045

4146
### Carthage
47+
4248
Pageboy is also available through [Carthage](https://github.com/Carthage/Carthage):
49+
4350
```ogdl
4451
github "uias/Pageboy" ~> 4.2
4552
```
4653

4754
## 🚀 Usage
55+
4856
- [The Basics](#the-basics)
4957
- [PageboyViewControllerDelegate](#pageboyViewControllerDelegate)
5058
- [Navigation](#navigation)
5159
- [Insertion & Deletion](#insertion-&-deletion)
5260

5361
### The Basics
5462

55-
1) Create an instance of a `PageboyViewController` and provide it with a `PageboyViewControllerDataSource`.
63+
1. Create an instance of a `PageboyViewController` and provide it with a `PageboyViewControllerDataSource`.
5664

5765
```swift
5866
class PageViewController: PageboyViewController, PageboyViewControllerDataSource {
5967

6068
override func viewDidLoad() {
6169
super.viewDidLoad()
62-
70+
6371
self.dataSource = self
6472
}
6573
}
6674
```
6775

68-
2) Implement the `PageboyViewControllerDataSource` functions.
76+
2. Implement the `PageboyViewControllerDataSource` functions.
6977

7078
```swift
7179
func numberOfViewControllers(in pageboyViewController: PageboyViewController) -> Int {
@@ -87,6 +95,7 @@ func defaultPage(for pageboyViewController: PageboyViewController) -> PageboyVie
8795
The delegate functions provided by a `PageboyViewController` are much more reliable and useful than what a raw `UIPageViewController` provides. You can use them to find out exactly where the current page is, and when it's moved, where it's headed.
8896

8997
#### willScrollToPageAtIndex
98+
9099
About to embark on a transition to a new page.
91100

92101
```swift
@@ -97,6 +106,7 @@ func pageboyViewController(_ pageboyViewController: PageboyViewController,
97106
```
98107

99108
#### didScrollToPosition
109+
100110
Scrolled to a relative position along the way transitioning to a new page.
101111

102112
```swift
@@ -107,6 +117,7 @@ func pageboyViewController(_ pageboyViewController: PageboyViewController,
107117
```
108118

109119
#### didScrollToPage
120+
110121
Successfully completed a scroll transition to a page.
111122

112123
```swift
@@ -117,6 +128,7 @@ func pageboyViewController(_ pageboyViewController: PageboyViewController,
117128
```
118129

119130
#### didReload
131+
120132
Child view controllers have been reloaded.
121133

122134
```swift
@@ -126,7 +138,9 @@ func pageboyViewController(_ pageboyViewController: PageboyViewController,
126138
```
127139

128140
### Navigation
141+
129142
You can navigate programmatically through a `PageboyViewController` using `scrollToPage()`:
143+
130144
```swift
131145
pageViewController.scrollToPage(.next, animated: true)
132146
```
@@ -135,14 +149,15 @@ pageViewController.scrollToPage(.next, animated: true)
135149
- Interactive scrolling can also be controlled with `.isScrollEnabled`.
136150

137151
### Insertion & Deletion
152+
138153
Pageboy provides the ability to insert and delete pages dynamically in the `PageboyViewController`.
139154

140155
```swift
141156
func insertPage(at index: PageIndex, then updateBehavior: PageUpdateBehavior)
142157
func deletePage(at index: PageIndex, then updateBehavior: PageUpdateBehavior)
143158
```
144159

145-
*This behaves similarly to the insertion of rows in `UITableView`, in the fact that you have to update the data source prior to calling any of the update functions.*
160+
_This behaves similarly to the insertion of rows in `UITableView`, in the fact that you have to update the data source prior to calling any of the update functions._
146161

147162
**Example:**
148163

@@ -152,7 +167,7 @@ viewControllers.insert(UIViewController(), at: index)
152167
pageViewController.insertPage(at: index)
153168
```
154169

155-
*The default behavior after inserting or deleting a page is to scroll to the update location, this however can be configured by passing a `PageUpdateBehavior` value other than `.scrollToUpdate`.*
170+
_The default behavior after inserting or deleting a page is to scroll to the update location, this however can be configured by passing a `PageUpdateBehavior` value other than `.scrollToUpdate`._
156171

157172
## ⚡️ Other Extras
158173

@@ -164,15 +179,17 @@ pageViewController.insertPage(at: index)
164179
- `.parentPageboy` - Access the immediate parent `PageboyViewController` from any child view controller.
165180

166181
### Animated Transitions
182+
167183
Pageboy also provides custom transition support for **animated transitions**. This can be customized via the `.transition` property on `PageboyViewController`.
168184

169185
```swift
170186
pageboyViewController.transition = Transition(style: .push, duration: 1.0)
171187
```
172188

173-
*Note: By default this is set to `nil`, which uses the standard animation provided by `UIPageViewController`.*
189+
_Note: By default this is set to `nil`, which uses the standard animation provided by `UIPageViewController`._
174190

175191
### Auto Scrolling
192+
176193
`PageboyAutoScroller` is available to set up timer based automatic scrolling of the `PageboyViewController`:
177194

178195
```swift
@@ -182,11 +199,14 @@ pageboyViewController.autoScroller.enable()
182199
Support for custom intermission duration and other scroll behaviors is also available.
183200

184201
## 👨🏻‍💻 About
202+
185203
- Created by [Merrick Sapsford](https://github.com/msaps) ([@MerrickSapsford](https://twitter.com/MerrickSapsford))
186204
- Contributed to by a growing [list of others](https://github.com/uias/Pageboy/graphs/contributors).
187205

188206
## ❤️ Contributing
207+
189208
Bug reports and pull requests are welcome on GitHub at [https://github.com/uias/Pageboy](https://github.com/uias/Pageboy).
190209

191210
## 👮🏻‍♂️ License
211+
192212
The library is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)