AI prompts
base on 📖 A simple, highly informative page view controller <p align="center">
<img src="Artwork/logo.png" width="890" alt="Pageboy"/>
</p>
<p align="center">
<a href="https://github.com/uias/Pageboy">
<img src="https://github.com/uias/Pageboy/workflows/Build/badge.svg" />
</a>
<img src="https://img.shields.io/badge/Swift-5-orange?logo=Swift&logoColor=white" />
<a href="https://github.com/uias/Pageboy/releases">
<img src="https://img.shields.io/github/release/uias/Pageboy.svg" />
</a>
<a href="https://swift.org/package-manager/">
<img src="https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg" />
</a>
</p>
**TL;DR** *UIPageViewController done properly.*
## ⭐️ Features
- [x] Simplified data source management & enhanced delegation.
- [x] Dynamically insert & remove pages.
- [x] Infinite scrolling support.
- [x] Automatic timer-based page transitioning.
- [x] Support for custom animated page transitions.
## 📋 Requirements
Pageboy requires iOS 12 / tvOS 12; and is compatible with Swift 5.
## 📲 Installation
### Swift Package Manager
Pageboy is compatible with [Swift Package Manager](https://swift.org/package-manager) and can be integrated via Xcode.
### CocoaPods
Pageboy is also available through [CocoaPods](https://cocoapods.org):
```ruby
pod 'Pageboy', '~> 4.2'
```
### Carthage
Pageboy is also available through [Carthage](https://github.com/Carthage/Carthage):
```ogdl
github "uias/Pageboy" ~> 4.2
```
## 🚀 Usage
- [The Basics](#the-basics)
- [PageboyViewControllerDelegate](#pageboyViewControllerDelegate)
- [Navigation](#navigation)
- [Insertion & Deletion](#insertion-&-deletion)
### The Basics
1) Create an instance of a `PageboyViewController` and provide it with a `PageboyViewControllerDataSource`.
```swift
class PageViewController: PageboyViewController, PageboyViewControllerDataSource {
override func viewDidLoad() {
super.viewDidLoad()
self.dataSource = self
}
}
```
2) Implement the `PageboyViewControllerDataSource` functions.
```swift
func numberOfViewControllers(in pageboyViewController: PageboyViewController) -> Int {
return viewControllers.count
}
func viewController(for pageboyViewController: PageboyViewController,
at index: PageboyViewController.PageIndex) -> UIViewController? {
return viewControllers[index]
}
func defaultPage(for pageboyViewController: PageboyViewController) -> PageboyViewController.Page? {
return nil
}
```
### PageboyViewControllerDelegate
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.
#### willScrollToPageAtIndex
About to embark on a transition to a new page.
```swift
func pageboyViewController(_ pageboyViewController: PageboyViewController,
willScrollToPageAt index: Int,
direction: PageboyViewController.NavigationDirection,
animated: Bool)
```
#### didScrollToPosition
Scrolled to a relative position along the way transitioning to a new page.
```swift
func pageboyViewController(_ pageboyViewController: PageboyViewController,
didScrollTo position: CGPoint,
direction: PageboyViewController.NavigationDirection,
animated: Bool)
```
#### didScrollToPage
Successfully completed a scroll transition to a page.
```swift
func pageboyViewController(_ pageboyViewController: PageboyViewController,
didScrollToPageAt index: Int,
direction: PageboyViewController.NavigationDirection,
animated: Bool)
```
#### didReload
Child view controllers have been reloaded.
```swift
func pageboyViewController(_ pageboyViewController: PageboyViewController,
didReloadWith currentViewController: UIViewController,
currentPageIndex: PageIndex)
```
### Navigation
You can navigate programmatically through a `PageboyViewController` using `scrollToPage()`:
```swift
pageViewController.scrollToPage(.next, animated: true)
```
- Infinite scrolling can be enabled with `.isInfiniteScrollEnabled`.
- Interactive scrolling can also be controlled with `.isScrollEnabled`.
### Insertion & Deletion
Pageboy provides the ability to insert and delete pages dynamically in the `PageboyViewController`.
```swift
func insertPage(at index: PageIndex, then updateBehavior: PageUpdateBehavior)
func deletePage(at index: PageIndex, then updateBehavior: PageUpdateBehavior)
```
*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.*
**Example:**
```swift
let index = 2
viewControllers.insert(UIViewController(), at: index)
pageViewController.insertPage(at: index)
```
*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`.*
## ⚡️ Other Extras
- `reloadData()` - Reload the view controllers in the page view controller. (Reloads the data source).
- `.navigationOrientation` - Whether to orientate the pages horizontally or vertically.
- `.currentViewController` - The currently visible view controller if it exists.
- `.currentPosition` - The exact current relative position of the page view controller.
- `.currentIndex` - The index of the currently visible page.
- `.parentPageboy` - Access the immediate parent `PageboyViewController` from any child view controller.
### Animated Transitions
Pageboy also provides custom transition support for **animated transitions**. This can be customized via the `.transition` property on `PageboyViewController`.
```swift
pageboyViewController.transition = Transition(style: .push, duration: 1.0)
```
*Note: By default this is set to `nil`, which uses the standard animation provided by `UIPageViewController`.*
### Auto Scrolling
`PageboyAutoScroller` is available to set up timer based automatic scrolling of the `PageboyViewController`:
```swift
pageboyViewController.autoScroller.enable()
```
Support for custom intermission duration and other scroll behaviors is also available.
## 👨🏻💻 About
- Created by [Merrick Sapsford](https://github.com/msaps) ([@MerrickSapsford](https://twitter.com/MerrickSapsford))
- Contributed to by a growing [list of others](https://github.com/uias/Pageboy/graphs/contributors).
## ❤️ Contributing
Bug reports and pull requests are welcome on GitHub at [https://github.com/uias/Pageboy](https://github.com/uias/Pageboy).
## 👮🏻♂️ License
The library is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
", Assign "at most 3 tags" to the expected json: {"id":"11187","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"