├── CustomTransitionDemo.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcuserdata │ └── rryan.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── CustomTransitionDemo.xcscheme └── project.pbxproj ├── CustomTransitionDemo ├── PresentationController.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── TransitioningDelegate.swift ├── PullDownAnimationController.swift ├── AppDelegate.swift ├── ViewController.swift ├── SecondViewController.swift └── HorizontalFlipAnimationController.swift └── README.md /CustomTransitionDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CustomTransitionDemo/PresentationController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PresentationController.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Robert Ryan on 2/13/17. 6 | // Copyright © 2017 Robert Ryan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class PresentationController: UIPresentationController { 12 | override var shouldRemovePresentersView: Bool { return true } 13 | } 14 | -------------------------------------------------------------------------------- /CustomTransitionDemo.xcodeproj/xcuserdata/rryan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CustomTransitionDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 837393561E52361B00E3EDB8 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /CustomTransitionDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Swift 3 Custom Transitions Demonstration 2 | 3 | This is an demonstration of using custom transitions in Swift 3, including interactive transitions and presentation controllers. 4 | 5 | See WWDC 2013 video [Custom Transitions Using View Controllers.](https://developer.apple.com/videos/wwdc/2013/?id=218), which shows an example of precisely this. For a discussion of presentation controllers, see WWDC 2014 videos [View Controller Advancements in iOS 8](https://developer.apple.com/videos/wwdc/2014/?id=214) and [A Look Inside Presentation Controllers](https://developer.apple.com/videos/wwdc/2014/?id=228). This is a Swift 3 implementation. 6 | 7 | 8 | ![example image](https://i.stack.imgur.com/gjrav.gif) 9 | 10 | See http://stackoverflow.com/a/42213998/1271826. 11 | 12 | This was developed in Swift 3 on Xcode 8.2.1 for iOS 10. But, the basic ideas are equally applicable for different versions of Swift and/or Objective-C. The use of presentation controller requires iOS 8 or later. 13 | 14 | ## License 15 | 16 | Copyright © 2017 Robert Ryan. All rights reserved. 17 | 18 | Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. 19 | 20 | -- 21 | 22 | 13 February 2017 23 | -------------------------------------------------------------------------------- /CustomTransitionDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0.1 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CustomTransitionDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CustomTransitionDemo/TransitioningDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TransitioningDelegate.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Robert Ryan on 2/13/17. 6 | // Copyright © 2017 Robert Ryan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TransitioningDelegate: NSObject, UIViewControllerTransitioningDelegate { 12 | 13 | /// Interaction controller 14 | /// 15 | /// If gesture triggers transition, it will set will manage its own 16 | /// `UIPercentDrivenInteractiveTransition`, but it must set this 17 | /// reference to that interaction controller here, so that this 18 | /// knows whether it's interactive or not. 19 | 20 | weak var interactionController: UIPercentDrivenInteractiveTransition? 21 | 22 | func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { 23 | return PullDownAnimationController(transitionType: .presenting) 24 | } 25 | 26 | func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { 27 | return PullDownAnimationController(transitionType: .dismissing) 28 | } 29 | 30 | func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? { 31 | return PresentationController(presentedViewController: presented, presenting: presenting) 32 | } 33 | 34 | func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? { 35 | return interactionController 36 | } 37 | 38 | func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? { 39 | return interactionController 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /CustomTransitionDemo/PullDownAnimationController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PullDownAnimationController.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Robert Ryan on 2/13/17. 6 | // Copyright © 2017 Robert Ryan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class PullDownAnimationController: NSObject, UIViewControllerAnimatedTransitioning { 12 | 13 | enum TransitionType { 14 | case presenting 15 | case dismissing 16 | } 17 | 18 | let transitionType: TransitionType 19 | 20 | init(transitionType: TransitionType) { 21 | self.transitionType = transitionType 22 | 23 | super.init() 24 | } 25 | 26 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { 27 | let inView = transitionContext.containerView 28 | let toView = transitionContext.view(forKey: .to)! 29 | let fromView = transitionContext.view(forKey: .from)! 30 | 31 | var frame = inView.bounds 32 | 33 | switch transitionType { 34 | case .presenting: 35 | frame.origin.y = -frame.size.height 36 | toView.frame = frame 37 | 38 | inView.addSubview(toView) 39 | UIView.animate(withDuration: transitionDuration(using: transitionContext), animations: { 40 | toView.frame = inView.bounds 41 | }, completion: { finished in 42 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled) 43 | }) 44 | case .dismissing: 45 | toView.frame = frame 46 | inView.insertSubview(toView, belowSubview: fromView) 47 | 48 | UIView.animate(withDuration: transitionDuration(using: transitionContext), animations: { 49 | frame.origin.y = -frame.size.height 50 | fromView.frame = frame 51 | }, completion: { finished in 52 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled) 53 | }) 54 | } 55 | } 56 | 57 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { 58 | return 0.5 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /CustomTransitionDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Robert Ryan on 2/13/17. 6 | // Copyright © 2017 Robert Ryan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /CustomTransitionDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Robert Ryan on 2/13/17. 6 | // Copyright © 2017 Robert Ryan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | let panDown = UIPanGestureRecognizer(target: self, action: #selector(handleGesture(_:))) 17 | panDown.delegate = self 18 | view.addGestureRecognizer(panDown) 19 | } 20 | 21 | var interactionController: UIPercentDrivenInteractiveTransition? 22 | 23 | // pan down transitions to next view controller 24 | 25 | @objc func handleGesture(_ gesture: UIPanGestureRecognizer) { 26 | let translate = gesture.translation(in: gesture.view) 27 | let percent = translate.y / gesture.view!.bounds.size.height 28 | 29 | if gesture.state == .possible { 30 | if translate != .zero { 31 | let angle = atan2(translate.y, translate.x) 32 | print(angle) 33 | } 34 | } else if gesture.state == .began { 35 | let controller = storyboard!.instantiateViewController(withIdentifier: "SecondViewController") as! SecondViewController 36 | interactionController = UIPercentDrivenInteractiveTransition() 37 | controller.customTransitionDelegate.interactionController = interactionController 38 | 39 | present(controller, animated: true) 40 | } else if gesture.state == .changed { 41 | interactionController?.update(percent) 42 | } else if gesture.state == .ended || gesture.state == .cancelled { 43 | let velocity = gesture.velocity(in: gesture.view) 44 | interactionController?.completionSpeed = 0.999 // https://stackoverflow.com/a/42972283/1271826 45 | if (percent > 0.5 && velocity.y == 0) || velocity.y > 0 { 46 | interactionController?.finish() 47 | } else { 48 | interactionController?.cancel() 49 | } 50 | interactionController = nil 51 | } 52 | } 53 | 54 | } 55 | 56 | extension ViewController: UIGestureRecognizerDelegate { 57 | 58 | // make sure it only recognizes downward gestures 59 | 60 | func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { 61 | if let pan = gestureRecognizer as? UIPanGestureRecognizer { 62 | let translation = pan.translation(in: pan.view) 63 | let angle = atan2(translation.y, translation.x) 64 | return abs(angle - .pi / 2.0) < (.pi / 8.0) 65 | } 66 | return false 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /CustomTransitionDemo/SecondViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Robert Ryan on 2/13/17. 6 | // Copyright © 2017 Robert Ryan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SecondViewController: UIViewController { 12 | 13 | let customTransitionDelegate = TransitioningDelegate() 14 | 15 | required init?(coder aDecoder: NSCoder) { 16 | super.init(coder: aDecoder) 17 | 18 | modalPresentationStyle = .custom 19 | transitioningDelegate = customTransitionDelegate 20 | } 21 | 22 | override func viewDidLoad() { 23 | super.viewDidLoad() 24 | 25 | let panUp = UIPanGestureRecognizer(target: self, action: #selector(handleGesture(_:))) 26 | panUp.delegate = self 27 | view.addGestureRecognizer(panUp) 28 | } 29 | 30 | // pan down transitions to next view controller 31 | 32 | var interactionController: UIPercentDrivenInteractiveTransition? 33 | 34 | @objc func handleGesture(_ gesture: UIPanGestureRecognizer) { 35 | let translate = gesture.translation(in: gesture.view) 36 | let percent = -translate.y / gesture.view!.bounds.size.height 37 | 38 | if gesture.state == .began { 39 | interactionController = UIPercentDrivenInteractiveTransition() 40 | customTransitionDelegate.interactionController = interactionController 41 | 42 | dismiss(animated: true) 43 | } else if gesture.state == .changed { 44 | interactionController?.update(percent) 45 | } else if gesture.state == .ended { 46 | let velocity = gesture.velocity(in: gesture.view) 47 | interactionController?.completionSpeed = 0.999 // https://stackoverflow.com/a/42972283/1271826 48 | if (percent > 0.5 && velocity.y == 0) || velocity.y < 0 { 49 | interactionController?.finish() 50 | } else { 51 | interactionController?.cancel() 52 | } 53 | interactionController = nil 54 | } 55 | 56 | } 57 | 58 | @IBAction func didTapButton(_ sender: UIButton) { 59 | dismiss(animated: true) 60 | } 61 | 62 | } 63 | 64 | extension SecondViewController: UIGestureRecognizerDelegate { 65 | 66 | // make sure it only recognizes upward gestures 67 | 68 | func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { 69 | if let pan = gestureRecognizer as? UIPanGestureRecognizer { 70 | let translation = pan.translation(in: pan.view) 71 | let angle = atan2(translation.y, translation.x) 72 | return abs(angle + .pi / 2.0) < (.pi / 8.0) 73 | } 74 | return false 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /CustomTransitionDemo.xcodeproj/xcuserdata/rryan.xcuserdatad/xcschemes/CustomTransitionDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /CustomTransitionDemo/HorizontalFlipAnimationController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HorizontalFlipAnimationController.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Robert Ryan on 2/13/17. 6 | // Copyright © 2017 Robert Ryan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class HorizontalFlipAnimationController: NSObject, UIViewControllerAnimatedTransitioning { 12 | 13 | enum TransitionType { 14 | case presenting 15 | case dismissing 16 | } 17 | 18 | let transitionType: TransitionType 19 | 20 | init(transitionType: TransitionType) { 21 | self.transitionType = transitionType 22 | 23 | super.init() 24 | } 25 | 26 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { 27 | let inView = transitionContext.containerView 28 | let toView = transitionContext.view(forKey: .to)! 29 | let fromView = transitionContext.view(forKey: .from)! 30 | 31 | var frame = inView.bounds 32 | 33 | func flipTransform(angle: CGFloat, offset: CGFloat = 0) -> CATransform3D { 34 | var transform = CATransform3DMakeTranslation(offset, 0, 0) 35 | transform.m34 = -1.0 / 1600 36 | transform = CATransform3DRotate(transform, angle, 0, 1, 0) 37 | return transform 38 | } 39 | 40 | toView.frame = inView.bounds 41 | toView.alpha = 0 42 | 43 | let transformFromStart: CATransform3D 44 | let transformFromEnd: CATransform3D 45 | let transformFromMiddle: CATransform3D 46 | let transformToStart: CATransform3D 47 | let transformToMiddle: CATransform3D 48 | let transformToEnd: CATransform3D 49 | 50 | switch transitionType { 51 | case .presenting: 52 | transformFromStart = flipTransform(angle: 0, offset: inView.bounds.size.width / 2) 53 | transformFromEnd = flipTransform(angle: -.pi, offset: inView.bounds.size.width / 2) 54 | transformFromMiddle = flipTransform(angle: -.pi / 2) 55 | transformToStart = flipTransform(angle: .pi, offset: -inView.bounds.size.width / 2) 56 | transformToMiddle = flipTransform(angle: .pi / 2) 57 | transformToEnd = flipTransform(angle: 0, offset: -inView.bounds.size.width / 2) 58 | 59 | toView.layer.anchorPoint = CGPoint(x: 0, y: 0.5) 60 | fromView.layer.anchorPoint = CGPoint(x: 1, y: 0.5) 61 | 62 | case .dismissing: 63 | transformFromStart = flipTransform(angle: 0, offset: -inView.bounds.size.width / 2) 64 | transformFromEnd = flipTransform(angle: .pi, offset: -inView.bounds.size.width / 2) 65 | transformFromMiddle = flipTransform(angle: .pi / 2) 66 | transformToStart = flipTransform(angle: -.pi, offset: inView.bounds.size.width / 2) 67 | transformToMiddle = flipTransform(angle: -.pi / 2) 68 | transformToEnd = flipTransform(angle: 0, offset: inView.bounds.size.width / 2) 69 | 70 | toView.layer.anchorPoint = CGPoint(x: 1, y: 0.5) 71 | fromView.layer.anchorPoint = CGPoint(x: 0, y: 0.5) 72 | } 73 | 74 | toView.layer.transform = transformToStart 75 | fromView.layer.transform = transformFromStart 76 | inView.addSubview(toView) 77 | 78 | UIView.animateKeyframes(withDuration: self.transitionDuration(using: transitionContext), delay: 0, options: [], animations: { 79 | UIView.addKeyframe(withRelativeStartTime: 0, relativeDuration: 0.0) { 80 | toView.alpha = 0 81 | fromView.alpha = 1 82 | } 83 | UIView.addKeyframe(withRelativeStartTime: 0, relativeDuration: 0.5) { 84 | toView.layer.transform = transformToMiddle 85 | fromView.layer.transform = transformFromMiddle 86 | } 87 | UIView.addKeyframe(withRelativeStartTime: 0.5, relativeDuration: 0.0) { 88 | toView.alpha = 1 89 | fromView.alpha = 0 90 | } 91 | UIView.addKeyframe(withRelativeStartTime: 0.5, relativeDuration: 0.5) { 92 | toView.layer.transform = transformToEnd 93 | fromView.layer.transform = transformFromEnd 94 | } 95 | }, completion: { finished in 96 | toView.layer.transform = CATransform3DIdentity 97 | fromView.layer.transform = CATransform3DIdentity 98 | toView.layer.anchorPoint = CGPoint(x: 0.5, y: 0.5) 99 | fromView.layer.anchorPoint = CGPoint(x: 0.5, y: 0.5) 100 | 101 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled) 102 | }) 103 | } 104 | 105 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { 106 | return 1.0 107 | } 108 | } 109 | 110 | -------------------------------------------------------------------------------- /CustomTransitionDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 37 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 83 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /CustomTransitionDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8373935B1E52361B00E3EDB8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8373935A1E52361B00E3EDB8 /* AppDelegate.swift */; }; 11 | 8373935D1E52361B00E3EDB8 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8373935C1E52361B00E3EDB8 /* ViewController.swift */; }; 12 | 837393601E52361B00E3EDB8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8373935E1E52361B00E3EDB8 /* Main.storyboard */; }; 13 | 837393621E52361B00E3EDB8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 837393611E52361B00E3EDB8 /* Assets.xcassets */; }; 14 | 837393651E52361B00E3EDB8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 837393631E52361B00E3EDB8 /* LaunchScreen.storyboard */; }; 15 | 8373936D1E52363200E3EDB8 /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8373936C1E52363200E3EDB8 /* SecondViewController.swift */; }; 16 | 8373936F1E52365B00E3EDB8 /* PullDownAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8373936E1E52365B00E3EDB8 /* PullDownAnimationController.swift */; }; 17 | 837393711E52367300E3EDB8 /* HorizontalFlipAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 837393701E52367300E3EDB8 /* HorizontalFlipAnimationController.swift */; }; 18 | 837393731E5236E300E3EDB8 /* PresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 837393721E5236E300E3EDB8 /* PresentationController.swift */; }; 19 | 837393751E52370E00E3EDB8 /* TransitioningDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 837393741E52370E00E3EDB8 /* TransitioningDelegate.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 837393571E52361B00E3EDB8 /* CustomTransitionDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CustomTransitionDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 8373935A1E52361B00E3EDB8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 25 | 8373935C1E52361B00E3EDB8 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 26 | 8373935F1E52361B00E3EDB8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 837393611E52361B00E3EDB8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | 837393641E52361B00E3EDB8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | 837393661E52361B00E3EDB8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 8373936C1E52363200E3EDB8 /* SecondViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = ""; }; 31 | 8373936E1E52365B00E3EDB8 /* PullDownAnimationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PullDownAnimationController.swift; sourceTree = ""; }; 32 | 837393701E52367300E3EDB8 /* HorizontalFlipAnimationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HorizontalFlipAnimationController.swift; sourceTree = ""; }; 33 | 837393721E5236E300E3EDB8 /* PresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresentationController.swift; sourceTree = ""; }; 34 | 837393741E52370E00E3EDB8 /* TransitioningDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransitioningDelegate.swift; sourceTree = ""; }; 35 | 837393761E52456D00E3EDB8 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 36 | /* End PBXFileReference section */ 37 | 38 | /* Begin PBXFrameworksBuildPhase section */ 39 | 837393541E52361B00E3EDB8 /* Frameworks */ = { 40 | isa = PBXFrameworksBuildPhase; 41 | buildActionMask = 2147483647; 42 | files = ( 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXFrameworksBuildPhase section */ 47 | 48 | /* Begin PBXGroup section */ 49 | 8373934E1E52361B00E3EDB8 = { 50 | isa = PBXGroup; 51 | children = ( 52 | 837393761E52456D00E3EDB8 /* README.md */, 53 | 837393591E52361B00E3EDB8 /* CustomTransitionDemo */, 54 | 837393581E52361B00E3EDB8 /* Products */, 55 | ); 56 | sourceTree = ""; 57 | }; 58 | 837393581E52361B00E3EDB8 /* Products */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 837393571E52361B00E3EDB8 /* CustomTransitionDemo.app */, 62 | ); 63 | name = Products; 64 | sourceTree = ""; 65 | }; 66 | 837393591E52361B00E3EDB8 /* CustomTransitionDemo */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 8373935A1E52361B00E3EDB8 /* AppDelegate.swift */, 70 | 8373935C1E52361B00E3EDB8 /* ViewController.swift */, 71 | 8373936C1E52363200E3EDB8 /* SecondViewController.swift */, 72 | 837393741E52370E00E3EDB8 /* TransitioningDelegate.swift */, 73 | 837393721E5236E300E3EDB8 /* PresentationController.swift */, 74 | 8373936E1E52365B00E3EDB8 /* PullDownAnimationController.swift */, 75 | 837393701E52367300E3EDB8 /* HorizontalFlipAnimationController.swift */, 76 | 8373935E1E52361B00E3EDB8 /* Main.storyboard */, 77 | 837393611E52361B00E3EDB8 /* Assets.xcassets */, 78 | 837393631E52361B00E3EDB8 /* LaunchScreen.storyboard */, 79 | 837393661E52361B00E3EDB8 /* Info.plist */, 80 | ); 81 | path = CustomTransitionDemo; 82 | sourceTree = ""; 83 | }; 84 | /* End PBXGroup section */ 85 | 86 | /* Begin PBXNativeTarget section */ 87 | 837393561E52361B00E3EDB8 /* CustomTransitionDemo */ = { 88 | isa = PBXNativeTarget; 89 | buildConfigurationList = 837393691E52361B00E3EDB8 /* Build configuration list for PBXNativeTarget "CustomTransitionDemo" */; 90 | buildPhases = ( 91 | 837393531E52361B00E3EDB8 /* Sources */, 92 | 837393541E52361B00E3EDB8 /* Frameworks */, 93 | 837393551E52361B00E3EDB8 /* Resources */, 94 | ); 95 | buildRules = ( 96 | ); 97 | dependencies = ( 98 | ); 99 | name = CustomTransitionDemo; 100 | productName = CustomTransitionDemo; 101 | productReference = 837393571E52361B00E3EDB8 /* CustomTransitionDemo.app */; 102 | productType = "com.apple.product-type.application"; 103 | }; 104 | /* End PBXNativeTarget section */ 105 | 106 | /* Begin PBXProject section */ 107 | 8373934F1E52361B00E3EDB8 /* Project object */ = { 108 | isa = PBXProject; 109 | attributes = { 110 | LastSwiftUpdateCheck = 0820; 111 | LastUpgradeCheck = 0820; 112 | ORGANIZATIONNAME = "Robert Ryan"; 113 | TargetAttributes = { 114 | 837393561E52361B00E3EDB8 = { 115 | CreatedOnToolsVersion = 8.2.1; 116 | DevelopmentTeam = UZAPXQTVQ4; 117 | ProvisioningStyle = Automatic; 118 | }; 119 | }; 120 | }; 121 | buildConfigurationList = 837393521E52361B00E3EDB8 /* Build configuration list for PBXProject "CustomTransitionDemo" */; 122 | compatibilityVersion = "Xcode 3.2"; 123 | developmentRegion = English; 124 | hasScannedForEncodings = 0; 125 | knownRegions = ( 126 | en, 127 | Base, 128 | ); 129 | mainGroup = 8373934E1E52361B00E3EDB8; 130 | productRefGroup = 837393581E52361B00E3EDB8 /* Products */; 131 | projectDirPath = ""; 132 | projectRoot = ""; 133 | targets = ( 134 | 837393561E52361B00E3EDB8 /* CustomTransitionDemo */, 135 | ); 136 | }; 137 | /* End PBXProject section */ 138 | 139 | /* Begin PBXResourcesBuildPhase section */ 140 | 837393551E52361B00E3EDB8 /* Resources */ = { 141 | isa = PBXResourcesBuildPhase; 142 | buildActionMask = 2147483647; 143 | files = ( 144 | 837393651E52361B00E3EDB8 /* LaunchScreen.storyboard in Resources */, 145 | 837393621E52361B00E3EDB8 /* Assets.xcassets in Resources */, 146 | 837393601E52361B00E3EDB8 /* Main.storyboard in Resources */, 147 | ); 148 | runOnlyForDeploymentPostprocessing = 0; 149 | }; 150 | /* End PBXResourcesBuildPhase section */ 151 | 152 | /* Begin PBXSourcesBuildPhase section */ 153 | 837393531E52361B00E3EDB8 /* Sources */ = { 154 | isa = PBXSourcesBuildPhase; 155 | buildActionMask = 2147483647; 156 | files = ( 157 | 8373936D1E52363200E3EDB8 /* SecondViewController.swift in Sources */, 158 | 837393711E52367300E3EDB8 /* HorizontalFlipAnimationController.swift in Sources */, 159 | 8373935D1E52361B00E3EDB8 /* ViewController.swift in Sources */, 160 | 8373935B1E52361B00E3EDB8 /* AppDelegate.swift in Sources */, 161 | 8373936F1E52365B00E3EDB8 /* PullDownAnimationController.swift in Sources */, 162 | 837393751E52370E00E3EDB8 /* TransitioningDelegate.swift in Sources */, 163 | 837393731E5236E300E3EDB8 /* PresentationController.swift in Sources */, 164 | ); 165 | runOnlyForDeploymentPostprocessing = 0; 166 | }; 167 | /* End PBXSourcesBuildPhase section */ 168 | 169 | /* Begin PBXVariantGroup section */ 170 | 8373935E1E52361B00E3EDB8 /* Main.storyboard */ = { 171 | isa = PBXVariantGroup; 172 | children = ( 173 | 8373935F1E52361B00E3EDB8 /* Base */, 174 | ); 175 | name = Main.storyboard; 176 | sourceTree = ""; 177 | }; 178 | 837393631E52361B00E3EDB8 /* LaunchScreen.storyboard */ = { 179 | isa = PBXVariantGroup; 180 | children = ( 181 | 837393641E52361B00E3EDB8 /* Base */, 182 | ); 183 | name = LaunchScreen.storyboard; 184 | sourceTree = ""; 185 | }; 186 | /* End PBXVariantGroup section */ 187 | 188 | /* Begin XCBuildConfiguration section */ 189 | 837393671E52361B00E3EDB8 /* Debug */ = { 190 | isa = XCBuildConfiguration; 191 | buildSettings = { 192 | ALWAYS_SEARCH_USER_PATHS = NO; 193 | CLANG_ANALYZER_NONNULL = YES; 194 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 195 | CLANG_CXX_LIBRARY = "libc++"; 196 | CLANG_ENABLE_MODULES = YES; 197 | CLANG_ENABLE_OBJC_ARC = YES; 198 | CLANG_WARN_BOOL_CONVERSION = YES; 199 | CLANG_WARN_CONSTANT_CONVERSION = YES; 200 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 201 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 202 | CLANG_WARN_EMPTY_BODY = YES; 203 | CLANG_WARN_ENUM_CONVERSION = YES; 204 | CLANG_WARN_INFINITE_RECURSION = YES; 205 | CLANG_WARN_INT_CONVERSION = YES; 206 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 207 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 208 | CLANG_WARN_UNREACHABLE_CODE = YES; 209 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 210 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 211 | COPY_PHASE_STRIP = NO; 212 | DEBUG_INFORMATION_FORMAT = dwarf; 213 | ENABLE_STRICT_OBJC_MSGSEND = YES; 214 | ENABLE_TESTABILITY = YES; 215 | GCC_C_LANGUAGE_STANDARD = gnu99; 216 | GCC_DYNAMIC_NO_PIC = NO; 217 | GCC_NO_COMMON_BLOCKS = YES; 218 | GCC_OPTIMIZATION_LEVEL = 0; 219 | GCC_PREPROCESSOR_DEFINITIONS = ( 220 | "DEBUG=1", 221 | "$(inherited)", 222 | ); 223 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 224 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 225 | GCC_WARN_UNDECLARED_SELECTOR = YES; 226 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 227 | GCC_WARN_UNUSED_FUNCTION = YES; 228 | GCC_WARN_UNUSED_VARIABLE = YES; 229 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 230 | MTL_ENABLE_DEBUG_INFO = YES; 231 | ONLY_ACTIVE_ARCH = YES; 232 | SDKROOT = iphoneos; 233 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 234 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 235 | TARGETED_DEVICE_FAMILY = "1,2"; 236 | }; 237 | name = Debug; 238 | }; 239 | 837393681E52361B00E3EDB8 /* Release */ = { 240 | isa = XCBuildConfiguration; 241 | buildSettings = { 242 | ALWAYS_SEARCH_USER_PATHS = NO; 243 | CLANG_ANALYZER_NONNULL = YES; 244 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 245 | CLANG_CXX_LIBRARY = "libc++"; 246 | CLANG_ENABLE_MODULES = YES; 247 | CLANG_ENABLE_OBJC_ARC = YES; 248 | CLANG_WARN_BOOL_CONVERSION = YES; 249 | CLANG_WARN_CONSTANT_CONVERSION = YES; 250 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 251 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 252 | CLANG_WARN_EMPTY_BODY = YES; 253 | CLANG_WARN_ENUM_CONVERSION = YES; 254 | CLANG_WARN_INFINITE_RECURSION = YES; 255 | CLANG_WARN_INT_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 258 | CLANG_WARN_UNREACHABLE_CODE = YES; 259 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 260 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 261 | COPY_PHASE_STRIP = NO; 262 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 263 | ENABLE_NS_ASSERTIONS = NO; 264 | ENABLE_STRICT_OBJC_MSGSEND = YES; 265 | GCC_C_LANGUAGE_STANDARD = gnu99; 266 | GCC_NO_COMMON_BLOCKS = YES; 267 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 268 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 269 | GCC_WARN_UNDECLARED_SELECTOR = YES; 270 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 271 | GCC_WARN_UNUSED_FUNCTION = YES; 272 | GCC_WARN_UNUSED_VARIABLE = YES; 273 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 274 | MTL_ENABLE_DEBUG_INFO = NO; 275 | SDKROOT = iphoneos; 276 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 277 | TARGETED_DEVICE_FAMILY = "1,2"; 278 | VALIDATE_PRODUCT = YES; 279 | }; 280 | name = Release; 281 | }; 282 | 8373936A1E52361B00E3EDB8 /* Debug */ = { 283 | isa = XCBuildConfiguration; 284 | buildSettings = { 285 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 286 | DEVELOPMENT_TEAM = UZAPXQTVQ4; 287 | INFOPLIST_FILE = CustomTransitionDemo/Info.plist; 288 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 289 | PRODUCT_BUNDLE_IDENTIFIER = com.robertmryan.CustomTransitionDemo; 290 | PRODUCT_NAME = "$(TARGET_NAME)"; 291 | SWIFT_VERSION = 3.0; 292 | }; 293 | name = Debug; 294 | }; 295 | 8373936B1E52361B00E3EDB8 /* Release */ = { 296 | isa = XCBuildConfiguration; 297 | buildSettings = { 298 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 299 | DEVELOPMENT_TEAM = UZAPXQTVQ4; 300 | INFOPLIST_FILE = CustomTransitionDemo/Info.plist; 301 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 302 | PRODUCT_BUNDLE_IDENTIFIER = com.robertmryan.CustomTransitionDemo; 303 | PRODUCT_NAME = "$(TARGET_NAME)"; 304 | SWIFT_VERSION = 3.0; 305 | }; 306 | name = Release; 307 | }; 308 | /* End XCBuildConfiguration section */ 309 | 310 | /* Begin XCConfigurationList section */ 311 | 837393521E52361B00E3EDB8 /* Build configuration list for PBXProject "CustomTransitionDemo" */ = { 312 | isa = XCConfigurationList; 313 | buildConfigurations = ( 314 | 837393671E52361B00E3EDB8 /* Debug */, 315 | 837393681E52361B00E3EDB8 /* Release */, 316 | ); 317 | defaultConfigurationIsVisible = 0; 318 | defaultConfigurationName = Release; 319 | }; 320 | 837393691E52361B00E3EDB8 /* Build configuration list for PBXNativeTarget "CustomTransitionDemo" */ = { 321 | isa = XCConfigurationList; 322 | buildConfigurations = ( 323 | 8373936A1E52361B00E3EDB8 /* Debug */, 324 | 8373936B1E52361B00E3EDB8 /* Release */, 325 | ); 326 | defaultConfigurationIsVisible = 0; 327 | defaultConfigurationName = Release; 328 | }; 329 | /* End XCConfigurationList section */ 330 | }; 331 | rootObject = 8373934F1E52361B00E3EDB8 /* Project object */; 332 | } 333 | --------------------------------------------------------------------------------