Home

Awesome

PanSlip

Build Status Swift Cocoapods Carthage compatible Platform License

Use PanGesture to dismiss view on UIViewController and UIView.

Introduction

PanSlip to UIViewController

left to rightright to lefttop to bottombottom to top
<img src="https://user-images.githubusercontent.com/15151687/59292203-8df41c00-8cb7-11e9-82ba-2a8dd3116c24.gif" width="155" height="330"><img src="https://user-images.githubusercontent.com/15151687/59292205-8fbddf80-8cb7-11e9-8f5d-27580041a429.gif" width="155" height="330"><img src="https://user-images.githubusercontent.com/15151687/59292211-9187a300-8cb7-11e9-83e2-2f51b519cbb5.gif" width="155" height="330"><img src="https://user-images.githubusercontent.com/15151687/59292214-93e9fd00-8cb7-11e9-9378-2cbe460de4d7.gif" width="155" height="330">

PanSlip to UIView

left to rightright to lefttop to bottombottom to top
<img src="https://user-images.githubusercontent.com/15151687/59292218-977d8400-8cb7-11e9-807f-5d5d096be483.gif" width="155" height="330"><img src="https://user-images.githubusercontent.com/15151687/59292220-9a787480-8cb7-11e9-9bd4-27a18d555b60.gif" width="155" height="330"><img src="https://user-images.githubusercontent.com/15151687/59292224-9cdace80-8cb7-11e9-8bc1-8401d9b794eb.gif" width="155" height="330"><img src="https://user-images.githubusercontent.com/15151687/59292228-a06e5580-8cb7-11e9-9b4e-8262ac573ac0.gif" width="155" height="330">

Usage

Enable

// UIViewController
let viewController = UIViewController()
viewController.ps.enable(slipDirection: .topToBottom) {
    // TODO completion when UIViewController dismissed
}

// UIView
let view = UIView()
view.ps.enable(slipDirection: .topToBottom) {
    // TODO completion when UIView dismissed
}

Disable

// UIViewController
let viewController = UIViewController()
viewController.ps.disable()

// UIView
let view = UIView()
view.ps.disable()

Manual slip

// UIViewController
let viewController = UIViewController()
viewController.ps.slip(animated: true)

// UIView
let view = UIView()
view.ps.slip(animated: true)

Set percentThreshold

// UIViewController
extension UIViewController: PanSlipBehavior {
    public var percentThreshold: CGFloat? {
        return 0.2
    }
}

// UIView
extension UIView: PanSlipBehavior {
    public var percentThreshold: CGFloat? {
        return 0.2
    }
}

Installation

CocoaPods (iOS 8+)

platform :ios, '8.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'PanSlip'
end

Carthage (iOS 8+)

github "k-lpmg/PanSlip"

LICENSE

These works are available under the MIT license. See the LICENSE file for more info.