Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement