{"id":2194,"url":"https://github.com/uias/Pageboy","last_synced_at":"2025-08-06T16:31:31.050Z","repository":{"id":17529854,"uuid":"78006543","full_name":"uias/Pageboy","owner":"uias","description":"📖 A simple, highly informative page view controller","archived":false,"fork":false,"pushed_at":"2024-10-28T18:54:15.000Z","size":10157,"stargazers_count":1995,"open_issues_count":36,"forks_count":155,"subscribers_count":26,"default_branch":"main","last_synced_at":"2024-12-06T10:35:30.526Z","etag":null,"topics":["ios","pages","swift","ui","uipageviewcontroller","viewpager"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uias.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["msaps"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-01-04T10:38:00.000Z","updated_at":"2024-12-04T09:00:21.000Z","dependencies_parsed_at":"2024-04-14T10:33:04.351Z","dependency_job_id":"fc00c752-29df-44b1-be98-8b22607e17b4","html_url":"https://github.com/uias/Pageboy","commit_stats":{"total_commits":813,"total_committers":32,"mean_commits":25.40625,"dds":0.06150061500615012,"last_synced_commit":"be0c1f6f1964cfb07f9d819b0863f2c3f255f612"},"previous_names":[],"tags_count":88,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uias%2FPageboy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uias%2FPageboy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uias%2FPageboy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uias%2FPageboy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uias","download_url":"https://codeload.github.com/uias/Pageboy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228667477,"owners_count":17954184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","pages","swift","ui","uipageviewcontroller","viewpager"],"created_at":"2024-01-05T20:16:07.231Z","updated_at":"2024-12-09T16:31:04.234Z","avatar_url":"https://github.com/uias.png","language":"Swift","funding_links":["https://github.com/sponsors/msaps"],"categories":["Libs","UI","Swift","UI [🔝](#readme)"],"sub_categories":["UI","Other free courses","Font","Other Testing"],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"Artwork/logo.png\" width=\"890\" alt=\"Pageboy\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/uias/Pageboy\"\u003e\n        \u003cimg src=\"https://github.com/uias/Pageboy/workflows/Build/badge.svg\" /\u003e\n    \u003c/a\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Swift-5-orange?logo=Swift\u0026logoColor=white\" /\u003e\n\t\u003ca href=\"https://github.com/uias/Pageboy/releases\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/release/uias/Pageboy.svg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://swift.org/package-manager/\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n**TL;DR** *UIPageViewController done properly.*\n\n## ⭐️ Features\n- [x] Simplified data source management \u0026 enhanced delegation.\n- [x] Dynamically insert \u0026 remove pages.\n- [x] Infinite scrolling support.\n- [x] Automatic timer-based page transitioning.\n- [x] Support for custom animated page transitions.\n\n## 📋 Requirements\nPageboy requires iOS 12 / tvOS 12; and is compatible with Swift 5.\n\n## 📲 Installation\n\n### Swift Package Manager\nPageboy is compatible with [Swift Package Manager](https://swift.org/package-manager) and can be integrated via Xcode.\n\n### CocoaPods\nPageboy is also available through [CocoaPods](https://cocoapods.org):\n```ruby\npod 'Pageboy', '~\u003e 4.2'\n```\n\n### Carthage\nPageboy is also available through [Carthage](https://github.com/Carthage/Carthage):\n```ogdl\ngithub \"uias/Pageboy\" ~\u003e 4.2\n```\n\n## 🚀 Usage\n- [The Basics](#the-basics)\n- [PageboyViewControllerDelegate](#pageboyViewControllerDelegate)\n- [Navigation](#navigation)\n- [Insertion \u0026 Deletion](#insertion-\u0026-deletion)\n\n### The Basics\n\n1) Create an instance of a `PageboyViewController` and provide it with a `PageboyViewControllerDataSource`.\n\n```swift\nclass PageViewController: PageboyViewController, PageboyViewControllerDataSource {\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \n\tself.dataSource = self\n    }\n}\n```\n\n2) Implement the `PageboyViewControllerDataSource` functions.\n\n```swift\nfunc numberOfViewControllers(in pageboyViewController: PageboyViewController) -\u003e Int {\n    return viewControllers.count\n}\n\nfunc viewController(for pageboyViewController: PageboyViewController,\n                    at index: PageboyViewController.PageIndex) -\u003e UIViewController? {\n    return viewControllers[index]\n}\n\nfunc defaultPage(for pageboyViewController: PageboyViewController) -\u003e PageboyViewController.Page? {\n    return nil\n}\n```\n\n### PageboyViewControllerDelegate\n\nThe 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.\n\n#### willScrollToPageAtIndex\nAbout to embark on a transition to a new page.\n\n```swift\nfunc pageboyViewController(_ pageboyViewController: PageboyViewController,\n                           willScrollToPageAt index: Int,\n                           direction: PageboyViewController.NavigationDirection,\n                           animated: Bool)\n```\n\n#### didScrollToPosition\nScrolled to a relative position along the way transitioning to a new page.\n\n```swift\nfunc pageboyViewController(_ pageboyViewController: PageboyViewController,\n                           didScrollTo position: CGPoint,\n                           direction: PageboyViewController.NavigationDirection,\n                           animated: Bool)\n```\n\n#### didScrollToPage\nSuccessfully completed a scroll transition to a page.\n\n```swift\nfunc pageboyViewController(_ pageboyViewController: PageboyViewController,\n                           didScrollToPageAt index: Int,\n                           direction: PageboyViewController.NavigationDirection,\n                           animated: Bool)\n```\n\n#### didReload\nChild view controllers have been reloaded.\n\n```swift\nfunc pageboyViewController(_ pageboyViewController: PageboyViewController,\n                           didReloadWith currentViewController: UIViewController,\n                           currentPageIndex: PageIndex)\n```\n\n### Navigation\nYou can navigate programmatically through a `PageboyViewController` using `scrollToPage()`:\n```swift\npageViewController.scrollToPage(.next, animated: true)\n```\n\n- Infinite scrolling can be enabled with `.isInfiniteScrollEnabled`.\n- Interactive scrolling can also be controlled with `.isScrollEnabled`.\n\n### Insertion \u0026 Deletion\nPageboy provides the ability to insert and delete pages dynamically in the `PageboyViewController`.\n\n```swift\nfunc insertPage(at index: PageIndex, then updateBehavior: PageUpdateBehavior)\nfunc deletePage(at index: PageIndex, then updateBehavior: PageUpdateBehavior)\n```\n\n*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.*\n\n**Example:**\n\n```swift\nlet index = 2\nviewControllers.insert(UIViewController(), at: index)\npageViewController.insertPage(at: index)\n```\n\n*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`.*\n\n## ⚡️ Other Extras\n\n- `reloadData()` - Reload the view controllers in the page view controller. (Reloads the data source).\n- `.navigationOrientation` - Whether to orientate the pages horizontally or vertically.\n- `.currentViewController` - The currently visible view controller if it exists.\n- `.currentPosition` - The exact current relative position of the page view controller.\n- `.currentIndex` - The index of the currently visible page.\n- `.parentPageboy` - Access the immediate parent `PageboyViewController` from any child view controller.\n\n### Animated Transitions\nPageboy also provides custom transition support for **animated transitions**. This can be customized via the `.transition` property on `PageboyViewController`.\n\n```swift\npageboyViewController.transition = Transition(style: .push, duration: 1.0)\n```\n\n*Note: By default this is set to `nil`, which uses the standard animation provided by `UIPageViewController`.*\n\n### Auto Scrolling\n`PageboyAutoScroller` is available to set up timer based automatic scrolling of the `PageboyViewController`:\n\n```swift\npageboyViewController.autoScroller.enable()\n```\n\nSupport for custom intermission duration and other scroll behaviors is also available.\n\n## 👨🏻‍💻 About\n- Created by [Merrick Sapsford](https://github.com/msaps) ([@MerrickSapsford](https://twitter.com/MerrickSapsford))\n- Contributed to by a growing [list of others](https://github.com/uias/Pageboy/graphs/contributors).\n\n## ❤️ Contributing\nBug reports and pull requests are welcome on GitHub at [https://github.com/uias/Pageboy](https://github.com/uias/Pageboy).\n\n## 👮🏻‍♂️ License\nThe library is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuias%2FPageboy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuias%2FPageboy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuias%2FPageboy/lists"}