• Stars
    star
    482
  • Rank 87,812 (Top 2 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

You can dismiss modal viewcontroller like Facebook Messenger by pulling scrollview or navigationbar in Swift.

PullToDismiss

PullToDismiss provides dismiss modal viewcontroller function like Facebook Messenger by pulling scrollview or navigationbar with smooth and rich background effect.

GitHub release Language Carthage Compatible CocoaPods CocoaPodsDL Awesome Reviewed by Hound


sample blur sample
gif gif

Feature

  • 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. (from v2.1~)

Migration guide

If you update from 1.x to 2.0, see migration guide if needed.

Usage

Getting Started

(1) Setup PullToDismiss

import PullToDismiss

class SampleViewController: UIViewController {
    @IBOutlet private weak var tableView: UITableView!
    private var pullToDismiss: PullToDismiss?
    override func viewDidLoad() {
        super.viewDidLoad()
        pullToDismiss = PullToDismiss(scrollView: tableView)
    }
}

(2) Create view controller and set modalPresentationStyle. Then present view controller

let vc = SampleViewController()
let nav = UINavigationController(rootViewController: vc)
nav.modalPresentationStyle = .overCurrentContext

self.present(nav, animated: true, completion: nil)

πŸ‘πŸ‘πŸ‘

Use (UIScrollView|UITableView|UICollectionView)Delegate

You can use all scroll view's delegate by set pullToDismiss.delegate.

import PullToDismiss

class SampleViewController: UIViewController {
    @IBOutlet private weak var tableView: UITableView!
    private var pullToDismiss: PullToDismiss?
    override func viewDidLoad() {
        super.viewDidLoad()
        pullToDismiss = PullToDismiss(scrollView: tableView)
        pullToDismiss?.delegate = self
    }
}

extension SampleViewController: UITableViewDelegate {
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        // ...
    }

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        // ...
    }
}

Customize

You can customize backgroundEffect, dismissableHeightPercentage:

Shadow background effet

  • background (default: ShadowEffect.default, [color: black, alpha: 0.8])

img1

pullToDismiss?.background = ShadowEffect(color: .red, alpha: 0.5) // color: red, alpha: 0.5

Blur background effect

New feature for v1.0.

gif

// preset blur (.extraLight, .light, .dark)
pullToDismiss?.background = BlurEffect.extraLight

// set custom Blur
pullToDismiss?.background = BlurEffect(color: .red, alpha: 0.5, blurRadius: 40.0, saturationDeltaFactor: 1.8)

dismissableHeightPercentage

img2

// to pull half size of view controller, dismiss view controller.
pullToDismiss?.dismissableHeightPercentage = 0.5

Requirements

  • iOS 8.0+ (blur effect: iOS 9.0+)
  • Xcode 8.1+
  • Swift 3.0+

Installation

Carthage

  • Add the following to your Cartfile:
# Swift 5.0 or later
github "sgr-ksmt/PullToDismiss" ~> 2.2
# Swift 3
github "sgr-ksmt/PullToDismiss", 2.1
  • Run carthage update
  • Add the framework as described.
    Details: Carthage Readme

CocoaPods

PullToDismiss is available through CocoaPods. To install it, simply add the following line to your Podfile:

# Swift 5.0 or later
pod 'PullToDismiss', '~> 2.2'
# Swift 3
pod 'PullToDismiss', '2.1'

and run pod install

Manually Install

Download all *.swift files and put your project.

Change log

Change log is here.

Communication

  • 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:

License

PullToDismiss is under MIT license. See the LICENSE file for more info.

More Repositories

1

PDFGenerator

A simple generator of PDF written in Swift.
Swift
749
star
2

FireTodo

Simple Todo Application using SwiftUI / Firebase / Redux.
Swift
357
star
3

Alertift

Swifty, modern UIAlertController wrapper.
Swift
283
star
4

WaterfallLayout

water-fall layout in iOS
Swift
206
star
5

FormToolbar

Simple, movable and powerful toolbar for UITextField and UITextView.
Swift
86
star
6

Lobster

🦐 Type-safe Firebase-RemoteConfig helper library 🦐
Swift
76
star
7

firebase-ec-demo

E-commerce data model, security rules example using Cloud Firestore.
58
star
8

FireSnapshot

A useful Firebase-Cloud-Firestore Wrapper with Codable.
Swift
56
star
9

Shopping-Cart

Swift
45
star
10

SwiftUI-Firebase-Todo

Swift
35
star
11

BeautifulGridLayout

UICollectionView extension for showing beautiful grid!
Swift
32
star
12

SNSShare

Text/Image/URL share to Twitter/Facebook/LINE from App in Swift.
Swift
25
star
13

Once

Execute closure just once!!! Once is a micro framework.
Objective-C
19
star
14

FirstAppearing

[Swift] Helper Protocol-Extension for UIViewController's viewWillAppear/viewDidAppear.
Swift
17
star
15

Curriculum-Vitae

16
star
16

SwiftUI-Todo

Todo application example using SwiftUI
Swift
16
star
17

flutter-github-repo-explorer

This is an example application with Flutter using river_pod, state_notifier, and freezed.
Dart
16
star
18

firestore-like-feature-example

An example of like feature such as Twitter, Instagram with Cloud Firestore
TypeScript
15
star
19

TwitterLikeHeaderExample

Swift
15
star
20

Shrimp

Shrimp is Firebase-RemoteConfig helper library.
Swift
14
star
21

BlendingCulturesExample

Example for "Blending Cultures" of try! Swift's Presentation
Swift
12
star
22

cloud-functions-practical-configuration

TypeScript
11
star
23

RxFirebaseAuth

Combination of RxSwift and Firebase Authentication
Swift
11
star
24

DTFont

DynamicTypeFont helper. Easy creation, custom font etc.
Swift
10
star
25

firebase-recommended-template

The recommended template for developing with Firebase
HTML
8
star
26

Quiche

Type-safe Firestore query helper for Swift.
Swift
7
star
27

firestore-emulator-rules-test

Test Firestore rules using jest and firestore-emulator
TypeScript
6
star
28

RxPlayground

Xcode Playground with RxSwift
Swift
6
star
29

APIKitWithDecodableSample

APIKit x Swift.Decodable sample
Swift
5
star
30

Border

Border is CloudFunction libarry that connect Firebase and Stripe.
JavaScript
5
star
31

ApplicationEventObserver

Application notification event handling in Swift
Swift
5
star
32

i18nSwift

i18n for Swift
Swift
4
star
33

firestore-rules-test-example

TypeScript
4
star
34

dotfiles

Shell
3
star
35

ElastiQ

Generate ElasticSearch query in Swift
Swift
3
star
36

firebase-storage-rule-test-example

An Example of writing the test of storage.rules
TypeScript
3
star
37

SourceryDemo

Demo using Sourcery for auto-generating boiler-plate of `LogEvent`.
Swift
3
star
38

FDLBuilder

Firebase Dynamic Links builder
Swift
3
star
39

FormChangeable

Easy to move from UITextField/UITextView to next UITextField/UITextView written in Swift.
Swift
2
star
40

CloudFirestoreTestExample

Example for Cloud Firestore online test with jest.
TypeScript
2
star
41

EnhancedAutoReleasePool

EnhancedAutoReleasePool is ΞΌ-Library for autoreleasepool.
Swift
2
star
42

Pick

Protocol-Oriented PickerViewController
Swift
2
star
43

EnvToSwift

Config file generator from `.env`
Shell
1
star
44

FirebaseABTestingExample

Firebase A/B Testing Example
Swift
1
star
45

flutter_test_report_on_github_action_example

Dart
1
star
46

plain-emulator-sandbox

TypeScript
1
star
47

CloudFunctionsAPI

Provides secure request between client and Cloud Functions
Swift
1
star
48

SUCheckButton

light-weight check button in Swift.
Swift
1
star
49

my-styleguide

My coding styleguide
1
star
50

AutoIncrement_id_Realm_Example

Example of auto increment `id` in Realm
Ruby
1
star