Skip to content

Repository files navigation

CollectionViewTools

PlatformSwift VersionCarthage CompatibleCocoaPods CompatibleSPM CompatiblePRs Welcome

Effective framework, similar to TableViewTools for making your UICollectionView usage simple and comfortable. It allows you to move UICollectionView configuration and interaction logic to separated objects and simply register, add and remove cells from the collection view.

Features

  • Separate layer that synchronizes data with the cell appearance
  • Full implementation of UICollectionViewDelegate and UICollectionViewDataSource under the hood
  • Support of protocols and subclasses as data models

Requirements

  • iOS 8.2+
  • Xcode 8.0+

Installation

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add the framework to your project.

github "rosberry/CollectionViewTools"

CocoaPods

You can use CocoaPods to install CollectionViewTools by adding it to your Podfile:

platform:ios,'8.2'use_frameworks!pod'CollectionViewTools'

Manually

Drag Sources folder from last release into your project.

Usage

Creating manager

letmanager=CollectionViewManager(collectionView: collectionView)

Creating section

lettitles=["Item 1","Item 2","Item 3"]varcellItems= titles.map{ title inreturnExampleCollectionViewCellItem(title: title)}letsectionItem=GeneralCollectionViewSectionItem(cellItems: cellItems)
manager.sectionItems =[sectionItem]

Cell item implementation

classExampleCollectionViewCellItem:CollectionViewCellItem{typealiasCell=ExampleCollectionViewCellprivate(set)varreuseType:ReuseType=.class(Cell.self)privatelettitle:Stringinit(title:String){self.title = title
}func configure(_ cell:UICollectionViewCell){guardlet cell = cell as?Cellelse{return}
cell.titleLabel.text = title
}func size()->CGSize{returnCGSize(width:100, height:40)}}

Authors

About

This project is owned and maintained by Rosberry. We build mobile apps for users worldwide 🌏.

Check out our open source projects, read our blog or give us a high-five on 🐦 @rosberryapps.

License

Product Name is available under the MIT license. See the LICENSE file for more info.

About

Effective framework for making your UICollectionView usage simple and comfortable

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages