SHARE
TWEET

Untitled

a guest Oct 19th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Foundation
  2. import UIKit
  3.  
  4. extension UIViewController {
  5.    
  6.     open func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, pushing: Bool, completion: (() -> Void)? = nil) {
  7.        
  8.         if pushing {
  9.            
  10.             let transition = CATransition()
  11.             transition.duration = 0.3
  12.             transition.type = CATransitionType.push
  13.             transition.subtype = CATransitionSubtype.fromRight
  14.             transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
  15.             view.window?.layer.add(transition, forKey: kCATransition)
  16.             viewControllerToPresent.modalPresentationStyle = .fullScreen
  17.             self.present(viewControllerToPresent, animated: false, completion: completion)
  18.            
  19.         } else {
  20.             self.present(viewControllerToPresent, animated: flag, completion: completion)
  21.         }
  22.        
  23.     }
  24.    
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top