Skip to content

Commit

Permalink
Separate missing protocol requirement methods
Browse files Browse the repository at this point in the history
  • Loading branch information
devxoul committed Dec 1, 2017
1 parent fe0c548 commit 2fc8c9e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Sources/URLNavigator/NavigatorType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ public protocol NavigatorType {
@discardableResult
func presentViewController(_ viewController: UIViewController, wrap: UINavigationController.Type?, from: UIViewControllerType?, animated: Bool, completion: (() -> Void)?) -> UIViewController?

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


Expand Down Expand Up @@ -120,7 +125,7 @@ extension NavigatorType {
}

@discardableResult
public func open(_ url: URLConvertible, context: Any? = nil) -> Bool {
public func openURL(_ url: URLConvertible, context: Any?) -> Bool {
guard let handler = self.handler(for: url, context: context) else { return false }
return handler()
}
Expand Down Expand Up @@ -149,5 +154,10 @@ extension NavigatorType {
public func present(_ viewController: UIViewController, wrap: UINavigationController.Type? = nil, from: UIViewControllerType? = nil, animated: Bool = true, completion: (() -> Void)? = nil) -> UIViewController? {
return self.presentViewController(viewController, wrap: wrap, from: from, animated: animated, completion: completion)
}

@discardableResult
public func open(_ url: URLConvertible, context: Any? = nil) -> Bool {
return self.openURL(url, context: context)
}
}
#endif

0 comments on commit 2fc8c9e

Please sign in to comment.