CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

JWMixedList 1.1.0

JWMixedList 1.1.0

Maintained by Joe Williams.



JWMixedList

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Why?

  • Data agnostic UITableViewControllers
  • Data agnostic UICollectionViewControllers
  • Better abstractions layer of abstraction around data sources
  • Easier to test

If you have ever found yourself writing the following code:

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {

    let cell: UICollectionViewCell

    if indexPath.item == 0 {
        cell = collectionView.dequeue(someCell) as! TypeA
        cell.configure()
    } else if indexPath.item == 2 {
        cell = collectionView.dequeue(someCell) as! TypeB
        cell.configure()
    } else {
        fatalError("This is getting long...")
    }

    return cell
}

You might benefit from abstracting out into Item Controllers. You remove all this logic by having some FeedDataType enum, and switching over that.

Check the Example project to see how it's implemented, and the benefits you might be able to get from it.

Contributing

There are a few things this doesn't support, and some challenges it faces. If you have solutions, please raise a PR!

Installation

JWMixedList is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'JWMixedList'

Author

Joe Williams

License

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