{"id":17163105,"url":"https://github.com/noppefoxwolf/pager","last_synced_at":"2026-02-19T06:32:16.134Z","repository":{"id":220527529,"uuid":"751875775","full_name":"noppefoxwolf/Pager","owner":"noppefoxwolf","description":"A small horizontal paging library","archived":false,"fork":false,"pushed_at":"2024-12-06T18:22:02.000Z","size":97,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-05T19:55:20.112Z","etag":null,"topics":[],"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/noppefoxwolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2024-02-02T14:19:36.000Z","updated_at":"2024-12-05T17:47:31.000Z","dependencies_parsed_at":"2024-12-05T17:41:06.303Z","dependency_job_id":null,"html_url":"https://github.com/noppefoxwolf/Pager","commit_stats":null,"previous_names":["noppefoxwolf/pager"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noppefoxwolf%2FPager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noppefoxwolf%2FPager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noppefoxwolf%2FPager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noppefoxwolf%2FPager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noppefoxwolf","download_url":"https://codeload.github.com/noppefoxwolf/Pager/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240091256,"owners_count":19746506,"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":[],"created_at":"2024-10-14T22:47:47.640Z","updated_at":"2026-02-19T06:32:16.121Z","avatar_url":"https://github.com/noppefoxwolf.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pager\n\nUIKit pager view controller with a scroll-synced tab bar and indicator, built on compositional layout and diffable data sources.\n\n![](.github/sample.gif)\n\n## Features\n- Host any `UIViewController` per page via `Page` providers; works inside navigation or tab stacks.\n- Scroll-synced tab bar whose indicator width follows the current label; optional selection haptics.\n- Programmatic or observed selection through `selectedPage` with safe pre-load application.\n- Safe rotation/resizing: keeps the current page and indicator aligned on size changes.\n- Customizable content insets per page (`itemContentInsets`) for floating headers / safe areas.\n- Targets iOS 17+ and visionOS 1+ (Swift tools 6.2).\n\n## Installation (Swift Package Manager)\nAdd the package to Xcode or your `Package.swift`:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/noppefoxwolf/Pager.git\", from: \"0.1.0\")\n]\n```\n\nThen add `Pager` to your target dependencies.\n\n## Quick start\n```swift\nimport Pager\nimport SwiftUI\n\nfinal class PagesViewController: PageViewController {\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        pages = [\n            Page(id: \"home\", title: \"Home\") { page in\n                UIHostingController(rootView: Text(page.title))\n            },\n            Page(id: \"list\", title: \"List\") { _ in\n                TableViewController(style: .plain)   // any UIViewController works\n            }\n        ]\n\n        // Programmatically select a page (can be set before view loads)\n        selectedPage = pages.first\n\n        // Place the tab bar beneath the navigation bar\n        let interaction = UIScrollEdgeElementContainerInteraction()\n        interaction.scrollView = collectionView\n        interaction.edge = .top\n        pageTabBar.addInteraction(interaction)\n\n        collectionView.superview?.addSubview(pageTabBar)\n        pageTabBar.translatesAutoresizingMaskIntoConstraints = false\n        NSLayoutConstraint.activate([\n            pageTabBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),\n            pageTabBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),\n            pageTabBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),\n            pageTabBar.heightAnchor.constraint(equalToConstant: 34)\n        ])\n\n        // Keep page content clear of the tab bar\n        itemContentInsets.top = 34\n    }\n}\n```\n\n`pages` can be updated at runtime (append/remove) and the pager refreshes automatically through diffable data sources; `selectedPage` tracks the visible page and can be set to jump.\n\n## Key types\n- `PageViewController`: horizontally paged collection view controller exposing `pages`, `selectedPage`, `pageTabBar`, `itemContentInsets`, and `reloadData()`.\n- `Page`: page descriptor containing `id`, `title`, and a `viewControllerProvider`.\n- `PageTabBar`: horizontally scrolling tab bar with an indicator that tracks scroll progress and emits selection haptics.\n\n## Examples\nOpen `Playground.swiftpm` to try the interactive sample (dynamic tab add/remove, table/collection content). The preview GIF in `.github/sample.gif` was captured from this playground.\n\n## Testing\nSee `TESTING.md` for running the iOS simulator tests with `xcodebuild`.\n\n## License\nMIT - see the [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoppefoxwolf%2Fpager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoppefoxwolf%2Fpager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoppefoxwolf%2Fpager/lists"}