Git Product home page Git Product logo

cardcollection's Introduction

A Dynamic Material Design Card for iOS

Changing Cards and CardItems

CardViewController makes use of a Card factory that you can use to inject N Cards. A maximum number of Items per Card, MaxItems, can be supplied, and a random number between 1 and maxItems will be included in the card.

CollectionTableCell

The CollectionTableCell is the UITableViewCell that will contain a UICollectionView. If we want to display a single Card - We will be displaying a tableView with a single Cell. 

A single CollectionTableCell, containing a UICollectionView dor every Card, we will display a CollectionTableCell. Their data source is a CardViewModel. CardViewModel contains an array of ItemViewModels- Its data-source. Each of these is displayed using a custom UICollectionViewCell.

Each ItemCell is registered in our UICollectionView. When a new ItemCell is created it needs to be registered with CollectionTableCell.

CardFlowLayout

CardFlowLayout is how each Item cell is displayed in a column. The Item width is set to the width of the collection view.

CardViewModel

CardViewModel is initialized with a Card model. For the example project, A TitleItemViewModel and an ImageItemViewModel is injected as the first and second objects in the data-source array. Each Item model in our Card is used to create an ItemCellViewModel. Finally, a FooterItemViewmodel is appended. 

CardItemCell

CardItemCell is a parent class of all the items in our collection View.

Items

CardItems are simply custom UICollectionViewCells and their corresponding ViewModel. Theres no limit to the number of Item types used in a Card. In the case of the sample application, 4 CardItems have been defined. TextItemCell, a TitleItemCell, FooterItemCell and an ImageItemCell

cardcollection's People

Contributors

hamstringassassin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.