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

#uiview #uiviewcontroller
YOU MIGHT ALSO LIKE...
ACarousel

A carousel view for SwiftUI

Sparklines for macOS, iOS and tvOS

A lightweight sparkline component, supporting Swift, SwiftUI, macCatalyst and Objective-C.     What is a sparkline? A sparkline is a very ...

Light Chart

LightChart is a lightweight SwiftUI package with line charts implementation. You can use it when you need only a chart that will perfectly ...

SwiftUICharts

Swift package for displaying charts effortlessly. V2 Beta is here 🎉🎉🎉 V2 focuses on providing a strong and easy to ...

SwiftUI BarChart

Lightweight and easy to use SwiftUI chart library for all Apple platforms