GithubHelp home page GithubHelp logo

tarsbase / presentcardscroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from presentco/presentcardscroller

0.0 1.0 0.0 27.43 MB

A Pretty Card Scrolling UI in Swift

License: Apache License 2.0

Shell 0.27% Ruby 2.37% Swift 97.37%

presentcardscroller's Introduction

PresentCardScroller

A Pretty Card Scrolling UI in Swift.

Installation

CocoaPods

pod 'PresentCardScroller', :git => 'https://github.com/presentco/PresentCardScroller.git'

For more information see (Cocoapods.org)

Demo

Check out the demo project for a working example.

Basic usage

Init the card scroller and add some models:

    let cardScroller = CardScrollingViewController()

    let models = [ 
      CardModel(
          image: UIImage(named: "photo").unsafelyUnwrapped,
          title: "This is a card",
          subtitle: "Image credit 'foo'"
      ),
      ...
    ]
    cardScroller.configure(with: models)

To be notified of selected cards implement the delegate:

    cardScroller.delegate = self

    public protocol CardScrollingViewControllerDelegate: class {
      func cardScrolling(viewController: CardScrollingViewController, didSelectCardFor model: CardModel)
      ...
   }

Configuration

Some PresentCardScroller parameters you may wish to change along with their default values:

	/// If true cards are initially added with an animation
    public var animateCardDropIn = true
    
    /// If true a tap on a card will select the card regardless of position. If false
    /// only the top card is selectable and taps on other cards cause them to 
    /// auto-scroll to the top position.
    public var tapShowsCardAnyPosition = false
    
    /// If true cards scroll continuously with no adjustment to the stopping position.
    /// If false card scrolling will "settle" with a card aligned at the top of the view.
    public var cardsScrollContinuous = false
    
    /// The rolloff easing function exponent: y = x^power * const
    public var rolloffPower: CGFloat = 4 
    
    /// The rolloff easing function constant: y = x^power * const
    public var rolloffConstant: CGFloat = 3.0
    
    /// If `true`, the card alpha fades to zero as it leaves the screen.
    public let transformAlpha = false

presentcardscroller's People

Contributors

patniemeyer 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.