{"id":24302901,"url":"https://github.com/digipolitan/collection-view-paginable-behavior","last_synced_at":"2025-09-26T06:30:21.167Z","repository":{"id":56907397,"uuid":"79234654","full_name":"Digipolitan/collection-view-paginable-behavior","owner":"Digipolitan","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-07T01:18:25.000Z","size":1241,"stargazers_count":5,"open_issues_count":2,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-03-15T10:05:52.706Z","etag":null,"topics":["carthage","cocoapods","collection-view","fastlane","framework","ios","swift","tvos"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Digipolitan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-17T14:19:10.000Z","updated_at":"2023-05-23T04:14:52.000Z","dependencies_parsed_at":"2022-08-20T19:50:21.254Z","dependency_job_id":null,"html_url":"https://github.com/Digipolitan/collection-view-paginable-behavior","commit_stats":null,"previous_names":["digipolitan/collection-view-paginable-behavior-swift"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fcollection-view-paginable-behavior","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fcollection-view-paginable-behavior/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fcollection-view-paginable-behavior/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fcollection-view-paginable-behavior/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Digipolitan","download_url":"https://codeload.github.com/Digipolitan/collection-view-paginable-behavior/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234292497,"owners_count":18809358,"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":["carthage","cocoapods","collection-view","fastlane","framework","ios","swift","tvos"],"created_at":"2025-01-17T00:20:01.304Z","updated_at":"2025-09-26T06:30:20.399Z","avatar_url":"https://github.com/Digipolitan.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"DGCollectionViewPaginableBehavior\n=================================\n\n[![Build Status](https://travis-ci.org/Digipolitan/collection-view-paginable-behavior-swift.svg?branch=master)](https://travis-ci.org/Digipolitan/collection-view-grid-layout-swift)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/DGCollectionViewPaginableBehavior.svg)](https://img.shields.io/cocoapods/v/DGCollectionViewPaginableBehavior.svg)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Platform](https://img.shields.io/cocoapods/p/DGCollectionViewPaginableBehavior.svg?style=flat)](http://cocoadocs.org/docsets/DGCollectionViewPaginableBehavior)\n[![Twitter](https://img.shields.io/badge/twitter-@Digipolitan-blue.svg?style=flat)](http://twitter.com/Digipolitan)\n\nThe `PaginableBehavior` is a partial implentation of a `UICollectionViewDelegateFlowLayout` that allows you to paginate your collection of data with only few lines of code.\n\n![Demo](https://github.com/Digipolitan/collection-view-paginable-behavior-swift/blob/develop/Screenshots/capture.gif?raw=true \"Demo\")\n\n## Getting Started\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.\n\n### Prerequisites\n\nWorks with iOS 8+, tested on Xcode 8.2\n\n### Installing\n\nTo install the `DGCollectionViewPaginableBehavior` using **cocoapods**\n\n- Add an entry in your Podfile  \n\n```\n# Uncomment this line to define a global platform for your project\nplatform :ios, '8.0'\n\ntarget 'YourTarget' do\n  frameworks\n   use_frameworks!\n\n  # Pods for YourTarget\n  pod 'DGCollectionViewPaginableBehavior'\nend\n```\n\n- Then install the dependency with the `pod install` command.\n\n## Usage\n\nInitialize your behavior\n\n```swift\n\tlet behavior = DGCollectionViewPaginableBehavior()\n```\n\n### Configuration\n\nYou can customize the component by enabling few options:\n\n```swift\n    var options = DGCollectionViewPaginableBehavior.Options(automaticFetch: false)\n    options.countPerPage = 20 \t\t// default value used for all section, avoiding to implement the delegate\n    options.animatedUpdates = true\t// defines if the method reloadSections will be used after fetching the data\n    behavior.options = options\n```\n\n### Interacting with the component\n\nTo communicate with the PaginableBehavior, set its `delegate`. Then put the behavior as the delegate of your `CollectionView`.\n\n```swift\nbehavior.delegate = self\nself.collectionView.delegate = behavior\n```\n\nSince the `DGCollectionViewPaginableBehavior` inherits from `UICollectionViewDelegateFlowLayout` you can implement the methods of `UICollectionViewDelegate` to respond to interactions with the `collectionView`.\n Implements `UICollectionViewDelegateFlowLayout` for sizing information and finally\nthe `DGCollectionViewPaginableBehavior`, as you imagine, to adopt a paginable behavior.\n\n- DGCollectionViewPaginableBehaviorDelegate\n\n```swift\n\t/**\n\t* Gives the number of items to fetch for a given section.\n\t*/\n\t@objc optional func paginableBehavior(_ paginableBehavior: DGCollectionViewPaginableBehavior, countPerPageInSection section: Int) -\u003e Int\n\t/**\n\t* Core methods that will be called every time the user reach the end of the collection. Depending on the mode set for automatic fetch.\n\t*/\n\t@objc optional func paginableBehavior(_ paginableBehavior: DGCollectionViewPaginableBehavior, fetchDataFrom indexPath: IndexPath, count: Int, completion: @escaping (Error?, Int) -\u003e Void)\n```\n\n## Work with custom layout\n\nYou might want to use custom layout. If so, extend the behavior of the Paginable component. Here an example with our custom layout [DGCollectionViewGridLayout](https://github.com/Digipolitan/collection-view-grid-layout-swift)\n\n```swift\n/**\nSince the Paginable behavior is a partial implementation of UICollecitonViewDelegate,\nIt's the direct instance interacting with the collection View.\nIf your custom layout needs a delegate with specific methods, just extend the behavior of the Paginable component.\n**/\nextension DGCollectionViewPaginableBehavior: DGCollectionGridLayoutDelegate {\n\tpublic func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: DGCollectionViewGridLayout, heightForItemAt indexPath: IndexPath, columnWidth: CGFloat) -\u003e CGFloat {\n\t\treturn 90\n\t}\n\n\tpublic func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: DGCollectionViewGridLayout, heightForHeaderIn section: Int) -\u003e CGFloat {\n\t\treturn 42\n\t}\n\n\tpublic func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: DGCollectionViewGridLayout, heightForFooterIn section: Int) -\u003e CGFloat {\n\t\treturn 90\n\t}\n}\n```\n\n## Built With\n\n[Fastlane](https://fastlane.tools/)\nFastlane is a tool for iOS, Mac, and Android developers to automate tedious tasks like generating screenshots, dealing with provisioning profiles, and releasing your application.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for more details!\n\nThis project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md).\nBy participating, you are expected to uphold this code. Please report\nunacceptable behavior to [contact@digipolitan.com](mailto:contact@digipolitan.com).\n\n## License\n\nDGCollectionViewPaginableBehavior is licensed under the [BSD 3-Clause license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigipolitan%2Fcollection-view-paginable-behavior","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigipolitan%2Fcollection-view-paginable-behavior","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigipolitan%2Fcollection-view-paginable-behavior/lists"}