No Description

UIViewController+NavigationBack.swift 687B

1234567891011121314151617181920212223
  1. //
  2. // UIViewController+NavigationBack.swift
  3. // PaiaiUIKit
  4. //
  5. // Created by ffib on 2019/1/15.
  6. // Copyright © 2019 yb. All rights reserved.
  7. //
  8. import Foundation
  9. public extension UIViewController {
  10. func pushViewController<T: UIViewController & NavigationBackViewController>(_ vc: T, animted: Bool = true) {
  11. vc.setupNavigationBackItem()
  12. navigationController?.pushViewController(vc, animated: animted)
  13. vc.navigationController?.interactivePopGestureRecognizer?.setDelegate(vc)
  14. vc.navigationController?.interactivePopGestureRecognizer?.isEnabled = true
  15. }
  16. @objc func backToViewController() {
  17. popController(animated: true)
  18. }
  19. }