InKwon James Kim
5 years ago
16 changed files with 138 additions and 34 deletions
-
4GME Remit.xcodeproj/project.pbxproj
-
4GME Remit/Extensions/UIColor+Ext.swift
-
6GME Remit/Extensions/UIViewController+Ext.swift
-
6GME Remit/Modules/Home/User Interface/View/HomeViewController.swift
-
2GME Remit/Modules/LauncherScreen/User Interface/Wireframe/LauncherScreenWireframe.swift
-
8GME Remit/Modules/Main/User Interface/Wireframe/MainWireframe.swift
-
15GME Remit/Modules/RecipientModules/Recipients/User Interface/View/Recipients.storyboard
-
21GME Remit/Modules/RecipientModules/Recipients/User Interface/View/RecipientsViewController.swift
-
2GME Remit/Modules/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmitViewController.swift
-
12GME Remit/Modules/RewardModules/DetailOrder/User Interface/View/DetailOrderViewController.swift
-
3GME Remit/Modules/SideMenu/SideMenu.storyboard
-
2GME Remit/MultiLanguages/en.lproj/Localizable.strings
-
1GME Remit/Utilities/ConfirmAlert/ConfirmViewController.swift
-
1GME Remit/Utilities/GMEAlert/GMEAlertViewController.swift
-
83GME Remit/Utilities/SwipeNavigationController.swift
-
2GME Remit/Utilities/TablePresenter/User Interface/View/TablePresenterViewController.swift
@ -0,0 +1,83 @@ |
|||
// |
|||
// SwipeNavigationController.swift |
|||
// GME Remit |
|||
// |
|||
// Created by InKwon James Kim on 06/09/2019. |
|||
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
import UIKit |
|||
|
|||
class SwipeNavigationController: UINavigationController { |
|||
|
|||
// MARK: - Lifecycle |
|||
|
|||
override init(rootViewController: UIViewController) { |
|||
super.init(rootViewController: rootViewController) |
|||
} |
|||
|
|||
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { |
|||
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) |
|||
|
|||
delegate = self |
|||
} |
|||
|
|||
required init?(coder aDecoder: NSCoder) { |
|||
super.init(coder: aDecoder) |
|||
|
|||
delegate = self |
|||
} |
|||
|
|||
override func viewDidLoad() { |
|||
super.viewDidLoad() |
|||
|
|||
// This needs to be in here, not in init |
|||
interactivePopGestureRecognizer?.delegate = self |
|||
} |
|||
|
|||
deinit { |
|||
delegate = nil |
|||
interactivePopGestureRecognizer?.delegate = nil |
|||
} |
|||
|
|||
// MARK: - Overrides |
|||
|
|||
override func pushViewController(_ viewController: UIViewController, animated: Bool) { |
|||
duringPushAnimation = true |
|||
|
|||
super.pushViewController(viewController, animated: animated) |
|||
} |
|||
|
|||
// MARK: - Private Properties |
|||
|
|||
fileprivate var duringPushAnimation = false |
|||
|
|||
} |
|||
|
|||
// MARK: - UINavigationControllerDelegate |
|||
|
|||
extension SwipeNavigationController: UINavigationControllerDelegate { |
|||
|
|||
func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { |
|||
guard let swipeNavigationController = navigationController as? SwipeNavigationController else { return } |
|||
|
|||
swipeNavigationController.duringPushAnimation = false |
|||
} |
|||
|
|||
} |
|||
|
|||
// MARK: - UIGestureRecognizerDelegate |
|||
|
|||
extension SwipeNavigationController: UIGestureRecognizerDelegate { |
|||
|
|||
func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { |
|||
guard gestureRecognizer == interactivePopGestureRecognizer else { |
|||
return true // default value |
|||
} |
|||
|
|||
// Disable pop gesture in two situations: |
|||
// 1) when the pop animation is in progress |
|||
// 2) when user swipes quickly a couple of times and animations don't have time to be performed |
|||
return viewControllers.count > 1 && duringPushAnimation == false |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue