@@ -6,7 +6,7 @@ extension AppRouter {
6
6
///
7
7
/// - parameter animated: defines if popping should be animated
8
8
/// - parameter completion: called after successful popping
9
- public class func popFromTopNavigation( animated: Bool = true , completion: Action ? = nil ) {
9
+ public class func popFromTopNavigation( animated: Bool = true , completion: Func < Void , Void > ? = nil ) {
10
10
_ = topViewController ( ) ? . navigationController? . popViewController ( animated: animated, completion: completion)
11
11
}
12
12
}
@@ -19,7 +19,7 @@ extension UIViewController {
19
19
/// - parameter completion: Called after transition ends successfully.
20
20
/// - returns: [UIViewCotnroller]? - returns the popped controllers
21
21
@discardableResult
22
- public func pop( animated: Bool = true , completion: Action ? = nil ) -> [ UIViewController ] ? {
22
+ public func pop( animated: Bool = true , completion: Func < Void , Void > ? = nil ) -> [ UIViewController ] ? {
23
23
guard let stack = navigationController? . viewControllers , stack. count > 1 else {
24
24
AppRouter . print ( " #[AppRouter] can't pop \" \( String ( describing: self ) ) \" when only one controller in navigation stack! " )
25
25
return nil
@@ -45,7 +45,7 @@ extension UIViewController {
45
45
/// - parameter completion: Called after transition ends successfully
46
46
/// - returns: returns true if able to close
47
47
@discardableResult
48
- public func close( animated: Bool = true , completion: Action ? = nil ) -> Bool {
48
+ public func close( animated: Bool = true , completion: Func < Void , Void > ? = nil ) -> Bool {
49
49
if canPop ( ) {
50
50
_ = pop ( animated: animated, completion: completion)
51
51
} else if isModal {
@@ -103,7 +103,7 @@ extension UINavigationController {
103
103
/// - parameter viewController: controller to be pushed
104
104
/// - parameter animated: Set this value to true to animate the transition
105
105
/// - parameter completion: Called after transition ends successfully
106
- public func pushViewController( _ viewController: UIViewController , animated: Bool , completion: Action ? ) {
106
+ public func pushViewController( _ viewController: UIViewController , animated: Bool , completion: Func < Void , Void > ? ) {
107
107
guard !viewControllers. contains ( viewController) else { return AppRouter . print ( " #[AppRouter] can't push \" \( String ( describing: type ( of: viewController) ) ) \" , already in navigation stack! " ) }
108
108
pushViewController ( viewController, animated: animated)
109
109
_сoordinator ( animated, completion: completion)
@@ -115,7 +115,7 @@ extension UINavigationController {
115
115
/// - parameter completion: Called after transition ends successfully
116
116
/// - returns: the popped controller
117
117
@discardableResult
118
- public func popViewController( animated: Bool , completion: Action ? ) -> UIViewController ? {
118
+ public func popViewController( animated: Bool , completion: Func < Void , Void > ? ) -> UIViewController ? {
119
119
guard let popped = self . popViewController ( animated: animated) else { return nil }
120
120
_сoordinator ( animated, completion: completion)
121
121
return popped
@@ -128,7 +128,7 @@ extension UINavigationController {
128
128
/// - parameter completion: Called after transition ends successfully
129
129
/// - returns: [UIViewCotnroller]? - returns the popped controllers
130
130
@discardableResult
131
- public func popToViewController( _ viewController: UIViewController , animated: Bool , completion: Action ? ) -> [ UIViewController ] ? {
131
+ public func popToViewController( _ viewController: UIViewController , animated: Bool , completion: Func < Void , Void > ? ) -> [ UIViewController ] ? {
132
132
guard let popped = popToViewController ( viewController, animated: animated) else { return nil }
133
133
_сoordinator ( animated, completion: completion)
134
134
return popped
@@ -141,7 +141,7 @@ extension UINavigationController {
141
141
/// - parameter completion: Called after transition ends successfully
142
142
/// - returns: [UIViewCotnroller]? - returns the popped controllers
143
143
@discardableResult
144
- public func popToViewController< T: UIViewController > ( _ type: T . Type , animated: Bool , completion: Action ? ) -> [ UIViewController ] ? {
144
+ public func popToViewController< T: UIViewController > ( _ type: T . Type , animated: Bool , completion: Func < Void , Void > ? ) -> [ UIViewController ] ? {
145
145
guard let popped = popToViewController ( type, animated: animated) else { return nil }
146
146
_сoordinator ( animated, completion: completion)
147
147
return popped
@@ -153,13 +153,13 @@ extension UINavigationController {
153
153
/// - parameter completion: Called after transition ends successfully
154
154
/// - returns: [UIViewCotnroller]? - returns the popped controllers
155
155
@discardableResult
156
- public func popToRootViewController( animated: Bool , completion: Action ? ) -> [ UIViewController ] ? {
156
+ public func popToRootViewController( animated: Bool , completion: Func < Void , Void > ? ) -> [ UIViewController ] ? {
157
157
guard let popped = self . popToRootViewController ( animated: animated) else { return nil }
158
158
_сoordinator ( animated, completion: completion)
159
159
return popped
160
160
}
161
161
162
- fileprivate func _сoordinator( _ animated: Bool , completion: Action ? ) {
162
+ fileprivate func _сoordinator( _ animated: Bool , completion: Func < Void , Void > ? ) {
163
163
if let coordinator = transitionCoordinator , animated {
164
164
coordinator. animate ( alongsideTransition: nil ) { _ in
165
165
completion ? ( )
0 commit comments