Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/presentco/PresentCardScroller
A Pretty Card Scrolling UI in Swift
https://github.com/presentco/PresentCardScroller
Last synced: about 1 month ago
JSON representation
A Pretty Card Scrolling UI in Swift
- Host: GitHub
- URL: https://github.com/presentco/PresentCardScroller
- Owner: presentco
- License: apache-2.0
- Created: 2018-10-16T17:23:51.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-17T20:57:01.000Z (about 6 years ago)
- Last Synced: 2024-08-03T17:09:28.748Z (5 months ago)
- Language: Swift
- Homepage:
- Size: 26.8 MB
- Stars: 31
- Watchers: 5
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cocoa - PresentCardScroller
README
# 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](https://cocoapods.org/))### Demo
Check out the demo project for a working example.
### Basic usage
Init the card scroller and add some models:
```swift
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:
```swift
cardScroller.delegate = selfpublic protocol CardScrollingViewControllerDelegate: class {
func cardScrolling(viewController: CardScrollingViewController, didSelectCardFor model: CardModel)
...
}
```### Configuration
Some `PresentCardScroller` parameters you may wish to change along with their default values:
```swift
/// 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
````