Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/naru-jpn/View2ViewTransition
Custom interactive view controller transition from one view to another view.
https://github.com/naru-jpn/View2ViewTransition
Last synced: about 1 month ago
JSON representation
Custom interactive view controller transition from one view to another view.
- Host: GitHub
- URL: https://github.com/naru-jpn/View2ViewTransition
- Owner: naru-jpn
- License: mit
- Created: 2016-08-29T05:02:27.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-12-23T09:38:28.000Z (about 6 years ago)
- Last Synced: 2024-11-20T22:58:55.635Z (about 2 months ago)
- Language: Swift
- Size: 12.1 MB
- Stars: 850
- Watchers: 15
- Forks: 54
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - View2ViewTransition - Custom interactive view controller transition from one view to another view. (UI / Transition)
- awesome-ios-star - View2ViewTransition - Custom interactive view controller transition from one view to another view. (UI / Transition)
README
# View2ViewTransition
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen.svg)](https://github.com/Carthage/Carthage) ![Pod Version](https://img.shields.io/badge/Pod-1.0.0-blue.svg) ![Swift Version](https://img.shields.io/badge/Swift-4.2-orange.svg) ![License MIT](https://img.shields.io/badge/License-MIT-lightgrey.svg) ![Plaforms](https://img.shields.io/badge/Platform-iOS-lightgrey.svg)
Simple framework for custom interactive viewController transition from one view to another view.
## Installation
__Carthage__
```
github "naru-jpn/View2ViewTransition"
```__CocoaPods__
```
pod 'View2ViewTransition'
```## Usage
__Create TransitionController and implement presentation__
```swift
// Create TransitionController
var transitionController: TransitionController = TransitionController()
``````swift
// Present view controller with transition delegate
let presentedViewController: PresentedViewController = PresentedViewController()
presentedViewController.transitioningDelegate = transitionControllertransitionController.present(viewController: presentedViewController, on: self, attached: presentedViewController, completion: nil)
```(also supports push)
```swift
// Set transitionController as a navigation controller delegate and push.
let presentedViewController: PresentedViewController = PresentedViewController()if let navigationController = self.navigationController {
navigationController.delegate = transitionController
transitionController.push(viewController: presentedViewController, on: self, attached: presentedViewController)
}
```__Presenting viewController conforms View2ViewTransitionPresenting__
```swift
func initialFrame(userInfo: [String: AnyObject]?, isPresenting: Bool) -> CGRect
func initialView(userInfo: [String: AnyObject]?, isPresenting: Bool) -> UIView
func prepereInitialView(userInfo: [String: AnyObject]?, isPresenting: Bool) -> Void // (optional)
```__Presented viewController conforms View2ViewTransitionPresented__
```swift
func destinationFrame(userInfo: [String: AnyObject]?, isPresenting: Bool) -> CGRect
func destinationView(userInfo: [String: AnyObject]?, isPresenting: Bool) -> UIView
func prepareDestinationView(userInfo: [String: AnyObject]?, isPresenting: Bool) -> Void // (optional)
```### Use UserInfo
You can set userInfo to notify indexPath or share resource etc.
```swift
transitionController.userInfo = ["key": "value", ...]
```### Modify Animation Parameters
Animate with custom animation parameters.
```swift
// For present
transitionController.presentAnimationController.usingSpringWithDamping = 0.7
transitionController.presentAnimationController.initialSpringVelocity = 0.0
transitionController.presentAnimationController.animationOptions = [.CurveEaseInOut]// For dismiss
transitionController.dismissAnimationController.usingSpringWithDamping = 0.7
transitionController.dismissAnimationController.initialSpringVelocity = 0.0
transitionController.dismissAnimationController.animationOptions = [.CurveEaseInOut]
```### Debug Mode
If you have hierarchical view controllers (navigation controllers) in app, viewController to conform protocol is not intuitive. View2ViewTransition prints some information in debug mode.
```swift
let transitionController = TransitionController()
// ...
transitionController.debuging = true
```## Example
[View2ViewTransitionExample](https://github.com/naru-jpn/View2ViewTransition/tree/master/Example/View2ViewTransitionExample)