View2ViewTransition
Custom interactive view controller transition from one view to another view.
Install / Use
/learn @naru-jpn/View2ViewTransitionREADME
View2ViewTransition
Simple framework for custom interactive viewController transition from one view to another view.
<img src="https://github.com/naru-jpn/View2ViewTransition/blob/master/preview.gif?raw=true" width="300">Installation
Carthage
github "naru-jpn/View2ViewTransition"
CocoaPods
pod 'View2ViewTransition'
Usage
Create TransitionController and implement presentation
// Create TransitionController
var transitionController: TransitionController = TransitionController()
// Present view controller with transition delegate
let presentedViewController: PresentedViewController = PresentedViewController()
presentedViewController.transitioningDelegate = transitionController
transitionController.present(viewController: presentedViewController, on: self, attached: presentedViewController, completion: nil)
(also supports push)
// 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
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
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.
transitionController.userInfo = ["key": "value", ...]
Modify Animation Parameters
Animate with custom animation parameters.
// 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.
let transitionController = TransitionController()
// ...
transitionController.debuging = true
Example
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
