{"id":18867502,"url":"https://github.com/leekurg/lazyzcarousel","last_synced_at":"2026-04-24T12:04:45.486Z","repository":{"id":241576158,"uuid":"807071202","full_name":"leekurg/LazyZCarousel","owner":"leekurg","description":"Infinite paged scroll with page loading on demand","archived":false,"fork":false,"pushed_at":"2024-10-14T13:46:20.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-30T15:07:29.879Z","etag":null,"topics":["carousel-component","carousel-slider","infinite-scrolling","lazy-loading","scrollview","swiftui"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leekurg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-05-28T12:33:48.000Z","updated_at":"2024-10-14T13:46:05.000Z","dependencies_parsed_at":"2024-05-29T04:49:37.259Z","dependency_job_id":"61f7aa6c-7166-4434-9fb3-811b8b0d4286","html_url":"https://github.com/leekurg/LazyZCarousel","commit_stats":null,"previous_names":["leekurg/lazyzcarousel"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/leekurg/LazyZCarousel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leekurg%2FLazyZCarousel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leekurg%2FLazyZCarousel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leekurg%2FLazyZCarousel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leekurg%2FLazyZCarousel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leekurg","download_url":"https://codeload.github.com/leekurg/LazyZCarousel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leekurg%2FLazyZCarousel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261250176,"owners_count":23130533,"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":["carousel-component","carousel-slider","infinite-scrolling","lazy-loading","scrollview","swiftui"],"created_at":"2024-11-08T05:09:35.991Z","updated_at":"2026-04-24T12:04:40.457Z","avatar_url":"https://github.com/leekurg.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LazyZCarousel\nInfinite swipable paged view with on-demand page loading for  **iOS 14 and higher**.\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"361\" alt=\"LazyZCarousel sample\" src=\"https://github.com/leekurg/NavigationViewElastic/assets/105886145/275e5d77-2567-464e-aa34-7f7d7fd199ad\"\u003e\n\u003c/p\u003e\n\n### Overview\n**LazyZCarousel** is an ideal component for displaying large sets of data in a paginated form. \nThis component allows for smooth swiping through content until the end is reached, providing a seamless user experience. \nIt ensures high performance by only storing the page layout closure and the data for the current page, \nunlike some platform's **Lazy** containers. \nAdditionally, **LazyZCarousel** offers a paging API compatible with **iOS 14 and higher**, \nunlike the **ScrollView** paging API which is available only from **iOS 17**.\n\n### Details\n**LazyZCarousel** is built using a **ZStack** with offsets for the current, next, and previous pages. \nYou can provide an initial piece of data and a page layout using a **ViewBuilder** closure. \nThe component handles situations with nullable data by displaying placeholders for the next and previous pages if they exist. \nWhen the current page is displayed, **LazyZCarousel** checks for the existence of the next and previous pages. \nIf they exist, placeholders are shown with animations. After a swipe to another page is completed, \nthe current page data is updated and checks for the next/previous pages are performed again.\n\nYou can adjust the width ratio occupied by the page content within the range **[0.1, 1]**. \nThe default value is **0.7**, meaning that the page content will occupy **70%** of the available width.\n\n### Limitations\nThe infinite nature of **LazyZCarousel** is based on manipulating offsets with or without animations. \nTherefore, the identity of the page’s **View** should be loose when data changes. This means that the page \nlayout and the placeholder layout (when **data** is nil) are supposed to look similar to maintain a consistent appearance.\n\n### Install\n`SPM` installation: in **Xcode** tap «**File → Add packages…**», paste is search field the URL of this page and press «**Add package**».\n\n### Usage\nAnnotate `SwiftUI` file with «**import LazyZCarousel**». Then pass to **LazyZCarousel** a piece of data to present and a page layout closure:\n\n```\nstruct ExampleView: View {\n    @State var currentPageData: MyData\n\n    var body: some View {\n        LazyZCarousel(data: currentPageData, contentHRatio: 0.6) { data in\n            // Your page layout here\n        } isNextAvailable: {\n            // Logic to determine if next data is available\n        } fetchNext: { nextFromId in\n            // Logic to fetch next data\n        } isPrevAvailable: {\n            // Logic to determine if previous data is available\n        } fetchPrev: { prevFromId in\n            // Logic to fetch previous data\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleekurg%2Flazyzcarousel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleekurg%2Flazyzcarousel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleekurg%2Flazyzcarousel/lists"}