Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

zingat/SwipeUpView

Repository files navigation

SwipeUpView

CI Status Version License Platform

SCREENSHOT

Installation

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

pod 'SwipeUpView'

SwipeUpViewDatasource

extension ViewController : SwipeUpViewDatasource {

    func hideHeaderButton(_ swipeUpView: SwipeUpView) -> Bool {
        return false
    }

    func heightOfHeaderButton (_ swipeUpView : SwipeUpView) -> CGFloat {
        return 8.0
    }

    func widthOfHeaderButton (_ swipeUpView : SwipeUpView) -> CGFloat {
        return 50.0
    }

    func marginOfHeaderButton (_ swipeUpView : SwipeUpView) -> CGFloat {
        return 4.0
    }

    func colorOfHeaderButton (_ swipeUpView : SwipeUpView) -> UIColor {
        return .white
    }

    func firstOpenHeightIndex(_ swipeUpView: SwipeUpView) -> Int {
        return 1
    }

    ////SETTING HEIGHTS
    //if heights returns a non-empty CGFloat array, heightPercentages return value is not important
    func heights(_ swipeUpView: SwipeUpView) -> [CGFloat] {
        return [100, 300, 600]
    }
    
    func heightPercentages(_ swipeUpView: SwipeUpView) -> [CGFloat] {
        return [0.1, 0.5, 0.95]
    }
    ////

    ////SETTING HEIGHTS - 2
    //if heights returns an empty CGFloat array, heightPercentages return value will be used
    func heights(_ swipeUpView: SwipeUpView) -> [CGFloat] {
        return []
    }

    func heightPercentages(_ swipeUpView: SwipeUpView) -> [CGFloat] {
        return [0.1, 0.5, 0.95]
    }
    ////

}

SwipeUpViewDelegate

extension ViewController : SwipeUpViewDelegate {

    func swipeUpViewStateWillChange (_ swipeUpView : SwipeUpView, stateIndex : Int){
        NSLog("SwipeUpView state will change to %i", stateIndex)
    }

    func swipeUpViewStateDidChange (_ swipeUpView : SwipeUpView, stateIndex : Int){
        NSLog("SwipeUpView state did change to %i", stateIndex)
    }

    func swipeUpViewWillOpen (_ swipeUpView : SwipeUpView){
        NSLog("SwipeUpView state will open")
    }

    func swipeUpViewDidOpen (_ swipeUpView : SwipeUpView){
        NSLog("SwipeUpView state did open")
    }

    func swipeUpViewWillClose (_ swipeUpView : SwipeUpView){
        NSLog("SwipeUpView state will close")
    }

    func swipeUpViewDidClose (_ swipeUpView : SwipeUpView){
        NSLog("SwipeUpView state did close")
    }

}

Authors

Zingat Mobile Team

License

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