Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork55
You can dismiss modal viewcontroller like Facebook Messenger by pulling scrollview or navigationbar in Swift.
License
sgr-ksmt/PullToDismiss
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
PullToDismiss provides dismiss modal viewcontroller function like Facebook Messenger by pulling scrollview or navigationbar with smooth and rich background effect.
| sample | blur sample |
|---|---|
![]() | ![]() |
- Support all scroll views. (UIScrollView, UITableView, UICollectionView, UIWebView, WKWebView)
- Customizable. (dismiss background color, alpha, height percentage of dismiss)
- Available in UIViewController, UINavigationController.
- Automatically add pan gesture to navigation bar.
- Blur effect support.
- Objective-C support. (fromv2.1~)
If you update from 1.x to 2.0, seemigration guide if needed.
(1) SetupPullToDismiss
import PullToDismissclassSampleViewController:UIViewController{@IBOutletprivate weakvartableView:UITableView!privatevarpullToDismiss:PullToDismiss?overridefunc viewDidLoad(){ super.viewDidLoad() pullToDismiss=PullToDismiss(scrollView: tableView)}}
(2) Create view controller and setmodalPresentationStyle. Then present view controller
letvc=SampleViewController()letnav=UINavigationController(rootViewController: vc)nav.modalPresentationStyle=.overCurrentContextself.present(nav, animated:true, completion:nil)
👍👍👍
You can use all scroll view's delegate by setpullToDismiss.delegate.
import PullToDismissclassSampleViewController:UIViewController{@IBOutletprivate weakvartableView:UITableView!privatevarpullToDismiss:PullToDismiss?overridefunc viewDidLoad(){ super.viewDidLoad() pullToDismiss=PullToDismiss(scrollView: tableView) pullToDismiss?.delegate=self}}extensionSampleViewController:UITableViewDelegate{func scrollViewDidScroll(_ scrollView:UIScrollView){ // ...}func tableView(_ tableView:UITableView, didSelectRowAt indexPath:IndexPath){ // ...}}
You can customize backgroundEffect, dismissableHeightPercentage:
- background (default:
ShadowEffect.default, [color: black, alpha: 0.8])
pullToDismiss?.background=ShadowEffect(color:.red, alpha:0.5) // color: red, alpha: 0.5
New feature for v1.0.
// preset blur (.extraLight, .light, .dark)pullToDismiss?.background=BlurEffect.extraLight// set custom BlurpullToDismiss?.background=BlurEffect(color:.red, alpha:0.5, blurRadius:40.0, saturationDeltaFactor:1.8)
// to pull half size of view controller, dismiss view controller.pullToDismiss?.dismissableHeightPercentage=0.5
- iOS 8.0+ (blur effect: iOS 9.0+)
- Xcode 8.1+
- Swift 3.0+
- Add the following to yourCartfile:
# Swift 5.0 or latergithub"sgr-ksmt/PullToDismiss"~> 2.2# Swift 3github"sgr-ksmt/PullToDismiss", 2.1
- Run
carthage update - Add the framework as described.
Details:Carthage Readme
PullToDismiss is available throughCocoaPods. To installit, simply add the following line to your Podfile:
# Swift 5.0 or laterpod'PullToDismiss','~> 2.2'# Swift 3pod'PullToDismiss','2.1'
and runpod install
Download all*.swift files and put your project.
Change log ishere.
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.:muscle:
PullToDismiss is under MIT license. See theLICENSE file for more info.
About
You can dismiss modal viewcontroller like Facebook Messenger by pulling scrollview or navigationbar in Swift.
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.



