Skip to content

Commit 6fa2e38

Browse files
committed
Action typealias removed to avoid name collisions
1 parent 0f0e140 commit 6fa2e38

File tree

6 files changed

+19
-14
lines changed

6 files changed

+19
-14
lines changed

AppRouter.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Pod::Spec.new do |s|
33
s.name = "AppRouter"
4-
s.version = "3.0.0"
4+
s.version = "3.0.1"
55
s.summary = "UIViewController creation, navigation, utility methods for easy routing"
66

77
s.homepage = "https://github.com/MLSDev/AppRouter"

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [3.0.1](https://github.com/MLSDev/AppRouter/releases/tag/3.0.1)
6+
7+
Typealias Action = () -> () was removed to avoid collisions with "Action" framework class names
8+
9+
510
## [3.0.0](https://github.com/MLSDev/AppRouter/releases/tag/3.0.0)
611

712
WARNING: From now on Presenters source provider will use storyboard initial controller by default instead of one with class name as StoryboardID.
813
Make sure you check all code with default instantiations or with .presenter().fromStoryboard("name")
914

1015
All life circle observers was moved into Reactive namespace and can be accessed by calling instance.rx.onViewDidLoad() or Type.rx.onViewDidLoad()
1116

17+
1218
## [2.0.1](https://github.com/MLSDev/AppRouter/releases/tag/2.0.1)
1319

1420
Small visibility problems fixed

Plists/AppRouter.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>3.0.0</string>
18+
<string>3.0.1</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

Sources/Core/AppRouter+navigations.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extension AppRouter {
66
///
77
/// - parameter animated: defines if popping should be animated
88
/// - 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) {
1010
_ = topViewController()?.navigationController?.popViewController(animated: animated, completion: completion)
1111
}
1212
}
@@ -19,7 +19,7 @@ extension UIViewController {
1919
/// - parameter completion: Called after transition ends successfully.
2020
/// - returns: [UIViewCotnroller]? - returns the popped controllers
2121
@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]? {
2323
guard let stack = navigationController?.viewControllers , stack.count > 1 else {
2424
AppRouter.print("#[AppRouter] can't pop \"\(String(describing: self))\" when only one controller in navigation stack!")
2525
return nil
@@ -45,7 +45,7 @@ extension UIViewController {
4545
/// - parameter completion: Called after transition ends successfully
4646
/// - returns: returns true if able to close
4747
@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 {
4949
if canPop() {
5050
_ = pop(animated: animated, completion: completion)
5151
} else if isModal {
@@ -103,7 +103,7 @@ extension UINavigationController {
103103
/// - parameter viewController: controller to be pushed
104104
/// - parameter animated: Set this value to true to animate the transition
105105
/// - 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>?) {
107107
guard !viewControllers.contains(viewController) else { return AppRouter.print("#[AppRouter] can't push \"\(String(describing: type(of: viewController)))\", already in navigation stack!") }
108108
pushViewController(viewController, animated: animated)
109109
_сoordinator(animated, completion: completion)
@@ -115,7 +115,7 @@ extension UINavigationController {
115115
/// - parameter completion: Called after transition ends successfully
116116
/// - returns: the popped controller
117117
@discardableResult
118-
public func popViewController(animated: Bool, completion: Action?) -> UIViewController? {
118+
public func popViewController(animated: Bool, completion: Func<Void, Void>?) -> UIViewController? {
119119
guard let popped = self.popViewController(animated: animated) else { return nil }
120120
_сoordinator(animated, completion: completion)
121121
return popped
@@ -128,7 +128,7 @@ extension UINavigationController {
128128
/// - parameter completion: Called after transition ends successfully
129129
/// - returns: [UIViewCotnroller]? - returns the popped controllers
130130
@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]? {
132132
guard let popped = popToViewController(viewController, animated: animated) else { return nil }
133133
_сoordinator(animated, completion: completion)
134134
return popped
@@ -141,7 +141,7 @@ extension UINavigationController {
141141
/// - parameter completion: Called after transition ends successfully
142142
/// - returns: [UIViewCotnroller]? - returns the popped controllers
143143
@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]? {
145145
guard let popped = popToViewController(type, animated: animated) else { return nil }
146146
_сoordinator(animated, completion: completion)
147147
return popped
@@ -153,13 +153,13 @@ extension UINavigationController {
153153
/// - parameter completion: Called after transition ends successfully
154154
/// - returns: [UIViewCotnroller]? - returns the popped controllers
155155
@discardableResult
156-
public func popToRootViewController(animated: Bool, completion: Action?) -> [UIViewController]? {
156+
public func popToRootViewController(animated: Bool, completion: Func<Void, Void>?) -> [UIViewController]? {
157157
guard let popped = self.popToRootViewController(animated: animated) else { return nil }
158158
_сoordinator(animated, completion: completion)
159159
return popped
160160
}
161161

162-
fileprivate func _сoordinator(_ animated: Bool, completion: Action?) {
162+
fileprivate func _сoordinator(_ animated: Bool, completion: Func<Void, Void>?) {
163163
if let coordinator = transitionCoordinator , animated {
164164
coordinator.animate(alongsideTransition: nil) { _ in
165165
completion?()

Sources/Core/AppRouter+presenter.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ open class ViewControllerPresentConfiguration<T: UIViewController> {
100100
/// - parameter completion: The block to execute after the view controller is pushed.
101101
/// - returns: returns instance provided by `source` provider
102102
@discardableResult
103-
open func push(animated: Bool = true, completion: Action? = nil) -> T? {
103+
open func push(animated: Bool = true, completion: Func<Void, Void>? = nil) -> T? {
104104
guard let sourceController = source.provideController(T.self), let parent = provideEmbeddedController(sourceController) else { debug("error constructing source controller"); return nil }
105105
configurator(sourceController)
106106
guard let targetController = target.provideController(UIViewController.self) else { debug("error fetching target controller"); return nil }
@@ -115,7 +115,7 @@ open class ViewControllerPresentConfiguration<T: UIViewController> {
115115
/// - parameter completion: The block to execute after the view controller is presented.
116116
/// - returns: returns instance provided by `source` provider
117117
@discardableResult
118-
open func present(animated: Bool = true, completion: Action? = nil) -> T? {
118+
open func present(animated: Bool = true, completion: Func<Void, Void>? = nil) -> T? {
119119
guard let sourceController = source.provideController(T.self), let parent = provideEmbeddedController(sourceController) else { debug("error constructing source controller"); return nil }
120120
configurator(sourceController)
121121
guard let targetController = target.provideController(UIViewController.self) else { debug("error fetching target controller"); return nil }

Sources/Core/AppRouter.swift

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Foundation
22
import UIKit
33

4-
public typealias Action = ()->()
54
public typealias Func<T, U> = (T) -> U
65

76
/// Namespacing class

0 commit comments

Comments
 (0)