Latest 0.1.1
Homepage https://github.com/MatijaKruljac/VerticalCardSwitcher
License MIT
Platforms ios 8.0
Authors

VerticalCardSwitcher is inspired by Shazam Discover view. It is a vertical sequence of UIViews where first UIView in sequence is always completely displayed and every next UIView is partially displayed. Also there is VerticalCardSwitcherDelegate which is added for VerticalCardSwitcher customization. VerticalCardSwitcher is not implemented with UICollectionView and it’s contained inside parent view.

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first. There are two examples FirstViewController and SecondViewController.

  • Example 1 (FirstViewController):

  • Example 2 (SecondViewController):

Requirements

  • iOS 8.0+
  • Xcode 8
  • Swift 3.0

Installation

VerticalCardSwitcher is available through CocoaPods. To install
it, simply add the following lines to your Podfile:

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
    pod "VerticalCardSwitcher"
end

Usage

  1. Add VerticalCardSwitcherDelegate for delegate class:
    
    class ViewController: UIViewController, VerticalCardSwitcherDelegate {

}


2. Initialize and setup `VerticalCardSwitcher`:
```swift
private var verticalCardSwitcher: VerticalCardSwitcher!

verticalCardSwitcher = VerticalCardSwitcher.init(in: view)
verticalCardSwitcher.delegate = self
verticalCardSwitcher.display()
  1. Implement VerticalCardSwitcherDelegate required methods:
    
    func numberOfCards(for verticalCardSwitcher: VerticalCardSwitcher) -> Int {
    return 22
    }

func distanceBetweenCards(for verticalCardSwitcher: VerticalCardSwitcher) -> CGFloat {
return 20.0
}

func heightForCardView(in verticalCardSwitcher: VerticalCardSwitcher) -> CGFloat {
return 430.0
}

func sideMargins(for verticalCardSwitcher: VerticalCardSwitcher) -> CGFloat {
return 40.0
}

func addDesign(for cardView: CardView, at index: Int, in verticalCardSwitcher: VerticalCardSwitcher) {

}

// values from 0 to 1 (represents percentage of CardView height)
func heightOfShowedPartForEveryNextCard(in verticalCardSwitcher: VerticalCardSwitcher) -> CGFloat {
return 0.20
}


4. Implement `VerticalCardSwitcherDelegate` optional methods for scrolling events of CardView:
```swift
func currentCardScrolledDown(cardView: CardView, for verticalCardSwitcher: VerticalCardSwitcher) {
    print("currentCardScrolledDown")
}

func nextCardScrolledUp(cardView: CardView, for verticalCardSwitcher: VerticalCardSwitcher) {
    print("nextCardScrolledUp")
}

Author

Matija Kruljac, [email protected]

License

VerticalCardSwitcher is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "VerticalCardSwitcher",
    "version": "0.1.1",
    "summary": "VerticalCardSwitcher is library that provides UI list of cards which can be iterated by swiping up and down.",
    "description": "VerticalCardSwitcher is inspired by Shazam Discover view. It is a vertical sequence of UIViews where first UIView in sequence is always displayed and every next UIView is partially displayed. Also there is VerticalCardSwitcherDelegate which is added for VerticalCardSwitcher customization. VerticalCardSwitcher is not implemented with UICollectionView and it's contained inside parent view.",
    "homepage": "https://github.com/MatijaKruljac/VerticalCardSwitcher",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "[email protected]": "[email protected]"
    },
    "source": {
        "git": "https://github.com/MatijaKruljac/VerticalCardSwitcher.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "VerticalCardSwitcher/Classes/**/*",
    "pushed_with_swift_version": "3.1"
}

Pin It on Pinterest

Share This