Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/k-lpmg/PanSlip
Use PanGesture to dismiss view on UIViewController and UIView
https://github.com/k-lpmg/PanSlip
dismiss dismissible pangesture uiview uiviewcontroller
Last synced: about 1 month ago
JSON representation
Use PanGesture to dismiss view on UIViewController and UIView
- Host: GitHub
- URL: https://github.com/k-lpmg/PanSlip
- Owner: k-lpmg
- License: mit
- Created: 2019-06-11T16:57:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-08-03T05:25:55.000Z (over 2 years ago)
- Last Synced: 2024-10-02T16:46:32.725Z (2 months ago)
- Topics: dismiss, dismissible, pangesture, uiview, uiviewcontroller
- Language: Swift
- Size: 38.1 KB
- Stars: 104
- Watchers: 5
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-swift - PanSlip - Use PanGesture to dismiss view on UIViewController and UIView. (Libs / UI)
- awesome-swift - PanSlip - Use PanGesture to dismiss view on UIViewController and UIView. (Libs / UI)
- awesome-swift - PanSlip - Use PanGesture to dismiss view on UIViewController and UIView ` 📝 2 years ago` (UI [🔝](#readme))
- awesome-swift - PanSlip - Use PanGesture to dismiss view on UIViewController and UIView. (Libs / UI)
README
# PanSlip
[![Build Status](https://travis-ci.org/k-lpmg/PanSlip.svg?branch=master)](https://travis-ci.org/k-lpmg/PanSlip)
![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg)
[![Cocoapods](https://img.shields.io/cocoapods/v/PanSlip.svg?style=flat)](https://cocoapods.org/pods/PanSlip)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
![Platform](https://img.shields.io/badge/Platform-iOS-lightgrey.svg)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/k-lpmg/PanSlip/blob/master/LICENSE)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
```swift
// 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
```swift
// UIViewController
let viewController = UIViewController()
viewController.ps.disable()// UIView
let view = UIView()
view.ps.disable()
```#### Manual slip
```swift
// UIViewController
let viewController = UIViewController()
viewController.ps.slip(animated: true)// UIView
let view = UIView()
view.ps.slip(animated: true)
```#### Set percentThreshold
```swift
// 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+)
```ruby
platform :ios, '8.0'
use_frameworks!target '' do
pod 'PanSlip'
end
```#### Carthage (iOS 8+)
```ruby
github "k-lpmg/PanSlip"
```## LICENSE
These works are available under the MIT license. See the [LICENSE][license] file
for more info.[license]: LICENSE