Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shingt/draggablemodaltransition

Enables dragging interaction and animation of scrollView in a similar way to Facebook Messenger app.
https://github.com/shingt/draggablemodaltransition

animation ios scrollview swift uitableview

Last synced: 26 days ago
JSON representation

Enables dragging interaction and animation of scrollView in a similar way to Facebook Messenger app.

Awesome Lists containing this project

README

        

# DraggableModalTransition

[![Build Status](https://www.bitrise.io/app/774d809f168e4285/status.svg?token=WCF_C3OBjA-7ejReXNwuuQ&branch=master)](https://www.bitrise.io/app/774d809f168e4285)
[![Version](https://img.shields.io/cocoapods/v/DraggableModalTransition.svg?style=flat)](http://cocoapods.org/pods/DraggableModalTransition)
[![License](https://img.shields.io/cocoapods/l/DraggableModalTransition.svg?style=flat)](http://cocoapods.org/pods/DraggableModalTransition)
![Xcode 10.0+](https://img.shields.io/badge/Xcode-10.0%2B-blue.svg)
![iOS 10.0+](https://img.shields.io/badge/iOS-10.0%2B-blue.svg)
![Swift 4.2+](https://img.shields.io/badge/Swift-4.2%2B-orange.svg)

## Introduction

DraggableModalTransition enables dragging interaction and animation of scrollView in a similar way to Facebook Messenger app.
Inspired by [zoonooz/ZFDragableModalTransition](https://github.com/zoonooz/ZFDragableModalTransition). Key difference is you can **continue dragging scrollView after you have finished scrolling to top of it** (See example below).

## Example

Example project is available at `Example/DraggableModalTransition.xcodeproj`.

## Usage

Set an instance of `DraggableModalTransition` to `transitioningDelegate` of viewController you want to present.
Note that you have to keep an instance of `DraggableModalTransition` even after view is presented.

```swift
func presentModalView() {
let controller = ModalViewController()
let navigationController = UINavigationController(rootViewController: controller)

modalTransition = DraggableModalTransition(with: controller)
navigationController.transitioningDelegate = modalTransition
controller.modalViewControllerDelegate = modalTransition
present(navigationController, animated: true, completion: nil)
}
```

For now you also need to call `modalViewDidScroll` in your `scrollViewDidScroll`.

```swift
class ModalViewController {
weak var modalViewControllerDelegate: ModalViewControllerDelegate?
...
func scrollViewDidScroll(_ scrollView: UIScrollView) {
modalViewControllerDelegate?.modalViewDidScroll(scrollView)
}
}
```

See example project for more details.

## Requirements

* iOS9+
* Swift 4.2+
* Xcode 10.0+

## Installation

DraggableModalTransition is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "DraggableModalTransition"
```

## Author

shingt

## License

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