/AwesomeGrid

Create a simple and easy-to-use Grid Layout.

Primary LanguageSwiftMIT LicenseMIT

Awesome Grid Layout

Create a simple and easy-to-use Grid Layout

With this tool you can create an awesome grid layout based in collection view. It's simple, easy to implement and highly customizable.

Installation

POD Installation:

pod 'GridLayout', :git => 'https://github.com/leodegeus7/awesomeGrid.git'

Usage example

To use this tool you need to follow few steps:

  1. Create a Collection View inside a Controller on StoryBoard and set "GridView" in class of object and "GridLayout" in Custom Layout Class;
  2. Create an outlet with this object in your Controller, import the framework GridLayout and set the delegate GridLayoutDelegate;
  3. Override the func viewDidLayoutSubviews of your View Controller and insert the follow code inside:
gridView.gridDelegate = self
gridView.initialize(numberOfColumns: Int, debug: Bool ,optionalPadding: Int)
  1. Get de function getCellsSupport of delegate in your Controller, and create a array of CellSupports. CellSupport is the way that you set the content of cell and the position of cell in grid. You can construct a CellSupport passing your grid Layout and the coordinates of item:
CellSupport(gridView: GridView, row: Int, column: Int, squaresOfHeight: Int, squaresOfWidth: Int)
  1. Customize the view of your new Cell Support adding subViews in cellSupport.view
  2. Override func viewWillTransition of your Controller and set
gridView.viewWillTransition(size: size)

Hints

Release History

  • 0.0.1
    • First Commit

Meta

Leonardo Alexandre de Geus – @leodegeus7leonardodegeus@gmail.com

See LICENSE for more information.

https://github.com/leodegeus7