Skip to content

Commit 2fc8c9e

Browse files
committed
Separate missing protocol requirement methods
1 parent fe0c548 commit 2fc8c9e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Sources/URLNavigator/NavigatorType.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,13 @@ public protocol NavigatorType {
6666
@discardableResult
6767
func presentViewController(_ viewController: UIViewController, wrap: UINavigationController.Type?, from: UIViewControllerType?, animated: Bool, completion: (() -> Void)?) -> UIViewController?
6868

69+
/// Executes an URL open handler.
70+
///
71+
/// - note: It is not a good idea to use this method directly because this method requires all
72+
/// parameters. This method eventually gets called when opening an url, so it's
73+
/// recommended to implement this method only for mocking.
6974
@discardableResult
70-
func open(_ url: URLConvertible, context: Any?) -> Bool
75+
func openURL(_ url: URLConvertible, context: Any?) -> Bool
7176
}
7277

7378

@@ -120,7 +125,7 @@ extension NavigatorType {
120125
}
121126

122127
@discardableResult
123-
public func open(_ url: URLConvertible, context: Any? = nil) -> Bool {
128+
public func openURL(_ url: URLConvertible, context: Any?) -> Bool {
124129
guard let handler = self.handler(for: url, context: context) else { return false }
125130
return handler()
126131
}
@@ -149,5 +154,10 @@ extension NavigatorType {
149154
public func present(_ viewController: UIViewController, wrap: UINavigationController.Type? = nil, from: UIViewControllerType? = nil, animated: Bool = true, completion: (() -> Void)? = nil) -> UIViewController? {
150155
return self.presentViewController(viewController, wrap: wrap, from: from, animated: animated, completion: completion)
151156
}
157+
158+
@discardableResult
159+
public func open(_ url: URLConvertible, context: Any? = nil) -> Bool {
160+
return self.openURL(url, context: context)
161+
}
152162
}
153163
#endif

0 commit comments

Comments
 (0)