{"id":13465325,"url":"https://github.com/jindulys/ChainPageCollectionView","last_synced_at":"2025-03-25T16:31:47.327Z","repository":{"id":56905764,"uuid":"97907380","full_name":"jindulys/ChainPageCollectionView","owner":"jindulys","description":"A custom View with fancy collectionView animation","archived":false,"fork":false,"pushed_at":"2018-02-17T23:49:26.000Z","size":114142,"stargazers_count":792,"open_issues_count":2,"forks_count":58,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-15T01:17:04.325Z","etag":null,"topics":["animation","collectionview","collectionviewlayout","ios","swift"],"latest_commit_sha":null,"homepage":null,"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/jindulys.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}},"created_at":"2017-07-21T04:55:20.000Z","updated_at":"2025-02-20T06:51:20.000Z","dependencies_parsed_at":"2022-08-20T19:20:26.137Z","dependency_job_id":null,"html_url":"https://github.com/jindulys/ChainPageCollectionView","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jindulys%2FChainPageCollectionView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jindulys%2FChainPageCollectionView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jindulys%2FChainPageCollectionView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jindulys%2FChainPageCollectionView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jindulys","download_url":"https://codeload.github.com/jindulys/ChainPageCollectionView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245500248,"owners_count":20625533,"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":["animation","collectionview","collectionviewlayout","ios","swift"],"created_at":"2024-07-31T15:00:27.251Z","updated_at":"2025-03-25T16:31:47.318Z","avatar_url":"https://github.com/jindulys.png","language":"Swift","funding_links":[],"categories":["Libs","Animation [🔝](#readme)"],"sub_categories":["Animation"],"readme":"\u003ch3 align=\"center\"\u003e\n    \u003cimg src=\"Images/ChainPage.png\" width=540/\u003e\n\u003c/h3\u003e\n\n# ChainPageCollectionView\nA custom View with two level chained collection views and fancy transition animation.\n\n## Demo\n\n\u003cimg src=\"https://raw.githubusercontent.com/jindulys/ChainPageCollectionView/master/Images/new1.gif\" alt=\"Demo\" title=\"Demo\" width=\"330\"/\u003e         \u003cimg src=\"https://raw.githubusercontent.com/jindulys/ChainPageCollectionView/master/Images/new2.gif\" alt=\"Demo\" title=\"Demo\" width=\"330\"/\u003e\n\n## Requirements\n\n- iOS 9.0+\n- Xcode 8\n\n## Installation\n\n### CocoaPods\n\nUpdate your Podfile to include the following:\n\n```ruby\npod 'ChainPageCollectionView', '~\u003e 1.0'\n```\nRun `pod install`.\n\nNOTE: If you can not find the pod target. Please follow: https://stackoverflow.com/questions/31065447/no-such-module-when-i-use-cocoapods to build your pod target.\n\n### Carthage\n\nTo integrate `ChainPageCollectionView` with `Carthage`, specify it in your `Cartfile`\n\n```\ngithub \"jindulys/ChainPageCollectionView\" ~\u003e 1.0\n```\n\nThen, run the following command to build `ChainPageCollectionView` framework\n\n```\n$ carthage update\n```\nAt last, you need to set up your Xcode project manually to add `ChainPageCollectionView` framework.\n\nOn your application targets’ `General` settings tab, in the `Linked Frameworks and Libraries` section, drag and drop each framework you want to use from the `Carthage/Build` folder on disk.\n\nOn your application targets’ `Build Phases` settings tab, click the `+` icon and choose `New Run Script Phase`. Create a Run Script with the following content:\n\n```\n/usr/local/bin/carthage copy-frameworks\n```\nand add the paths to the frameworks you want to use under `Input Files`:\n\n```\n$(SRCROOT)/Carthage/Build/iOS/ChainPageCollectionView.framework\n```\n\nCheck [Carthage](https://github.com/Carthage/Carthage) if you need more help.\n\n## Usage\n\n### Basic Usage\n\n```swift\nimport ChainPageCollectionView\n```\n\n1. Create ChainPageCollectionView\n```swift\n// chainView is this view controller's property.\nchainView = ChainPageCollectionView(viewType: .normal)\nchainView.delegate = self\n```\n2. Register cell for `parentCollectionView` and `childCollectionView`\n```swift\nchainView.parentCollectionView.register(#cellType, forCellWithReuseIdentifier:#cellIdentifier)\nchainView.childCollectionView.register(#cellType, forCellWithReuseIdentifier:#cellIdentifier)\n```\n\n3. Implement `ChainPageCollectionViewProtocol`\n```swift\nfunc parentCollectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -\u003e Int {\n  // return your parent data source count.\n}\n\nfunc parenCollectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -\u003e UICollectionViewCell {\n  // Dequeue and configure your parent collectionview cell\n}\n\nfunc childCollectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -\u003e Int {\n  // return your child data source count.\n}\n\nfunc childCollectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -\u003e UICollectionViewCell {\n  // Dequeue and configure your child collectionview cell\n}\n```\n\n4. Update child collection view data source when parent index has changed.\n```swift\n// You will get notified by following protocol method.\nfunc childCollectionView(_ collectionView: UICollectionView, parentCollectionViewIndex: Int) {\n  // When parent collection view's scroll stops, this will get called with new parent collectionview's index.\n  // You can use this message to fetch related child collection view's new data.\n  \n  // Once you have the latest child collection view's data, set `childCollectionViewDataReady` to `true`.\n  // NOTE: This is important to be set, otherwise your child collection view propably will not show up again.\n  chainView.childCollectionViewDataReady = true\n}\n```\n\n### Customization\n\n#### Child Collection View Animation Type\n\nFor now `ChainPageCollectionView` support two types of child collection view transition animation.\n\n```swift\npublic enum ChainPageChildAnimationType {\n  case slideOutSlideIn\n  case shrinkOutExpandIn\n}\n```\n\nDefault is `slideOutSlideIn`, you can set it via initialization stage.\n```swift\nlet chainView = ChainPageCollectionView(viewType: .normal, \n                                        childAnimationType: #yourchoice)\n```\n\n#### Layout\n\nYou can customize the layout objects by passing them via `ChainPageCollectionView`'s designated initializer.\n```swift\nlet chainView = ChainPageCollectionView(viewType: .normal, \n                                        parentColectionViewLayout: #yourlayout, \n                                        childCollectionViewLayout: #yourlayout)\n```\n#### ItemSize\n\nYou can use `parentCollectionViewItemSize` and `childCollectionViewItemSize` to set related layouts' itemSize.\n\n#### Screen Ratio\n\nThe default behaviour of this view is that parent collection view takes `3/4` height of this view and child collection view takes the rest. You can set `viewType` to a customized ratio with type `customParentHeight(#SomeInt, #SomeInt)`\n```swift\nlet chainView = ChainPageCollectionView(viewType: .customParentHeight(28, 12))\n```\n\n## Author\nYansong Li ( liyansong.edw@gmail.com ), wechat: `jindulys_uw`\n\n## License\n\nExpanding collection is released under the MIT license.\nSee [LICENSE](./LICENSE) for details.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjindulys%2FChainPageCollectionView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjindulys%2FChainPageCollectionView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjindulys%2FChainPageCollectionView/lists"}