https://github.com/WorldDownTown/ZoomTransitioning
ZoomTransitioning provides a custom transition with image zooming animation and swiping the screen edge.
https://github.com/WorldDownTown/ZoomTransitioning
animation carthage cocoapods custom-transitions ios swift
Last synced: 8 months ago
JSON representation
ZoomTransitioning provides a custom transition with image zooming animation and swiping the screen edge.
- Host: GitHub
- URL: https://github.com/WorldDownTown/ZoomTransitioning
- Owner: WorldDownTown
- License: mit
- Created: 2016-07-07T23:00:29.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-07-01T23:52:56.000Z (over 6 years ago)
- Last Synced: 2024-11-06T22:45:18.212Z (over 1 year ago)
- Topics: animation, carthage, cocoapods, custom-transitions, ios, swift
- Language: Swift
- Homepage:
- Size: 22.4 MB
- Stars: 671
- Watchers: 19
- Forks: 54
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - ZoomTransitioning - A custom transition with image zooming animation. (UI / Animation)
- awesome-cocoa - ZoomTransitioning
- awesome-ios-star - ZoomTransitioning - A custom transition with image zooming animation. (UI / Animation)
- fucking-awesome-ios - ZoomTransitioning - A custom transition with image zooming animation. (UI / Animation)
README
# ZoomTransitioning
[](https://gitter.im/WorldDownTown/ZoomTransitioning?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://doge.mit-license.org)
[](https://developer.apple.com/swift)
[](https://github.com/Carthage/Carthage)
[](http://cocoadocs.org/docsets/ZoomTransitioning/)
[](http://cocoadocs.org/docsets/ZoomTransitioning/)
[](https://github.com/matteocrippa/awesome-swift#animation)
## Overview
`ZoomTransitioning` provides a custom transition with image zooming animation.
When you use this library with `UINavigationController`, you can pop view controller with edge swiping.

## Demo
Run the demo project in the Demo directory without `carthage update` or `pod install`.
## Usage
Refer to the example project for details.
### `import ZoomTransitioning`
### Adopt `ZoomTransitionSourceDelegate` to source view controller
```swift
extension ImageListViewController: ZoomTransitionSourceDelegate {
func transitionSourceImageView() -> UIImageView {
return selectedImageView
}
func transitionSourceImageViewFrame(forward forward: Bool) -> CGRect {
return selectedImageView.convertRect(selectedImageView.bounds, toView: view)
}
func transitionSourceWillBegin() {
selectedImageView.hidden = true
}
func transitionSourceDidEnd() {
selectedImageView.hidden = false
}
func transitionSourceDidCancel() {
selectedImageView.hidden = false
}
}
```
### Adopt `ZoomTransitionDestinationDelegate` to destination view controller
```swift
extension ImageDetailViewController: ZoomTransitionDestinationDelegate {
func transitionDestinationImageViewFrame(forward forward: Bool) -> CGRect {
if forward {
let x: CGFloat = 0.0
let y = topLayoutGuide.length
let width = view.frame.width
let height = width * 2.0 / 3.0
return CGRect(x: x, y: y, width: width, height: height)
} else {
return largeImageView.convertRect(largeImageView.bounds, toView: view)
}
}
func transitionDestinationWillBegin() {
largeImageView.hidden = true
}
func transitionDestinationDidEnd(transitioningImageView imageView: UIImageView) {
largeImageView.hidden = false
largeImageView.image = imageView.image
}
func transitionDestinationDidCancel() {
largeImageView.hidden = false
}
}
```
### set `delegate` property of `UINavigationController`
```swift
import ZoomTransitioning
class NavigationController: UINavigationController {
private let zoomNavigationControllerDelegate = ZoomNavigationControllerDelegate()
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
delegate = zoomNavigationControllerDelegate
}
}
```
## Requirements
- Swift 4.0
- iOS 9.0 or later
If you use Swift 2.2, use [1.3.0](https://github.com/WorldDownTown/ZoomTransitioning/releases/tag/1.3.0)
## Installation
### Carthage
ZoomTransitioning is available through [Carthage](https://github.com/Carthage/Carthage). To install it, simply add the following line to your Cartfile:
```
github "WorldDownTown/ZoomTransitioning"
```
### CocoaPods
ZoomTransitioning is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:
```ruby
pod 'ZoomTransitioning'
```
### Manually
1. Download and drop ```/ZoomTransitioning```folder in your project.
2. Congratulations!
## Author
WorldDownTown, WorldDownTown@gmail.com
## License
ZoomTransitioning is available under the MIT license. See the LICENSE file for more info.