PanSlip
  • December 4, 2023

Use PanGesture to dismiss view on UIViewController and UIView.

Introduction


PanSlip to UIViewController

left to right right to left top to bottom bottom to top

PanSlip to UIView

left to right right to left top to bottom bottom to top

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”

GitHub


View Github

#dismiss #dismissible #pangesture #uiview #uiviewcontroller
YOU MIGHT ALSO LIKE...
exyte

     

camerakit-ios

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service ...

HybridCamera

[video width="192" height="416" mp4="https://swiftgit.com/wp-content/uploads/2024/12/68747470733a2f2f7261776769742e636f6d2f7374796c656b69742f696d672f6d61737465722f7669645f6564697465645f325f326d622e676966.mp4"][/video]

TakeASelfie

An iOS framework that uses the front camera, detects your face and takes a selfie. This api opens the front ...

iOS-Depth-Sampler

Code examples of Depth APIs in iOS