Coder Social home page Coder Social logo

augmify / gliding-collection Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ramotion/gliding-collection

1.0 0.0 0.0 12.8 MB

Gliding Collection is a smooth, flowing, customizable decision for a UICollectionView Swift Controller

License: MIT License

Ruby 1.21% Swift 97.39% Objective-C 1.41%

gliding-collection's Introduction

header

Twitter PodPlatform PodVersion Documentation

Carthage Codebeat Swift


About

This project is maintained by Ramotion, Inc.
We specialize in the designing and coding of custom UI for Mobile Apps and Websites.

Looking for developers for your project?

animation

The iPhone mockup available here.

Requirements

  • iOS 8.0+
  • Xcode 8
  • Swift 3

Installation

You can install GlidingCollection in several ways:

  • Add source files to your project.

pod 'GlidingCollection'

github "Ramotion/gliding-collection"

How to use

• Create a view controller class:

import GlidingCollection

class ViewController: UIViewController {
  let items = ["gloves", "boots", "bindings", "hoodie"]
}

• Drag a UIView onto the canvas. Change it's class to GlidingCollection and use autolayout constraints.

step-2

• Connect this view to your view controller class as an @IBOutlet.

@IBOutlet var glidingCollection: GlidingCollection!

• Make your view controller conform to GlidingCollectionDatasource. It's very similar to the UITableView or UICollectionView datasource protocols that you know:

extension ViewController: GlidingCollectionDatasource {

  func numberOfItems(in collection: GlidingCollection) -> Int {
    return items.count
  }

  func glidingCollection(_ collection: GlidingCollection, itemAtIndex index: Int) -> String {
    return "" + items[index]
  }

}

• Make your view controller conform to UICollectionViewDatasource:

extension ViewController: UICollectionViewDatasource {
  
  func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    let section = glidingView.expandedItemIndex // Value of expanded section.
    return images[section].count
  }
  
  func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as? CollectionCell else { return UICollectionViewCell() }
    // Configure and return your cell.
    return cell
  }
  
}

Customize

You can customize the appearance of GlidingCollection by overriding GlidingConfig's shared instance with your own.

var config = GlidingConfig.shared
config.buttonsFont = UIFont.boldSystemFont(ofSize: 22)
config.activeButtonColor = .black
config.inactiveButtonsColor = .lightGray
GlidingConfig.shared = config

🗒 All parameters with their descriptions are listed in GlidingConfig.


Notes

There is a GlidingCollectionDelegate protocol which can notify you when item in GlidingCollection didSelect, willExpand and didExpand.

If you want to achieve a parallax effect on a horizontal cards stack, you need to place your parallax view in a cell's contentView and set its tag to 99.

parallax-view

There is a kGlidingCollectionParallaxViewTag constant if you want to layout a cell in code.

imageView.tag = kGlidingCollectionParallaxViewTag

License

GlidingCollection is released under the MIT license. See LICENSE for details.


Follow us

Twitter URL Twitter Follow

gliding-collection's People

Contributors

juriv avatar ramotionrussell avatar

Stargazers

 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.