Skip to content

Releases: devxoul/URLNavigator

2.0.3

30 Nov 17:43
Compare
Choose a tag to compare
  • Separate protocol requirement methods (#87)

2.0.2

07 Nov 20:33
Compare
Choose a tag to compare
  • Fix a crash from an UIApplication (6dad23e)
  • Use count on a String directly (6a148b7)

2.0.1

06 Nov 14:10
Compare
Choose a tag to compare
  • Consider an app extension environment (#82)
  • Supports Xcode 9.1 (Carthage)

2.0.0

19 Oct 05:40
Compare
Choose a tag to compare

Improvements

  • Add NavigatorType protocol. Use this protocol to inject a dependency of Navigator.
  • Add NavigatorDelegate protocol. Use this protocol to decide whether to push or present or not.

Migration Guide

  • Accessing an instance: A singleton instance named Navigator is removed and URLNavigator is renamed to Navigator. You have to create your own instance.

    - Navigator.foo()
    + let navigator = Navigator()
    + navigator.foo()
  • Mapping view controllers: Use register() to map view controllers. It takes a view controller factory instead of URLNavigable so that you can inject dependency to the view controller or create a view controller from Storyboard. Also, URLNavigable is removed.

    - Navigator.map("myapp://user/<id>", UserViewController.self)
    + navigator.register("myapp://user/<id>") { (url: URLConvertible, values: [String: Any], context: Any?) -> UIViewController? in
    +   let viewController = storyboard.instantiateViewController(withIdentifier: "foo")
    +   viewController.dependency = injectDependencyHere
    + }
  • Mapping url handlers: Use handler() to map url open handlers. URL open handlers now can take context as a third parameter.

    - Navigator.map("myapp://alert") { (url: URLConvertible, values: [String: Any]) -> Bool in
    -   return false
    - }
    + navigator.handle("myapp://alert") { (url: URLConvertible, values: [String: Any], context: Any?) -> Bool in
    +   return false
    + }
  • Presenting with a navigation controller: A type of the parameter wrap from present() is changed from Bool to UINavigationController.Type?. Pass nil if you don't want to wrap a view controller with a navigation controller and pass a class reference of UINavigationController or its subclass if you would like to wrap with a navigation controller.

    - Navigator.present("myapp://user/123", wrap: true)
    + navigator.present("myapp://user/123", wrap: MyNavigationController.self)
  • Custom URL value converters: URL value converters are now managed with a dictionary. Just set a value with custom value converter. Note that the handler parameters are changed from the single value to the entire path components and an index.

    - URLMatcher.default.addURLValueMatcherHandler(for: "foo") { (value: String) -> Any? in
    -   return value
    - }
    + navigator.matcher.valueConverters["foo"] = { (pathComponents: [String], index: Int) -> Any?
    +   return pathComponents[index]
    + }

1.3.0

25 Sep 09:58
Compare
Choose a tag to compare
  • Add Swift 4 support ✨

1.2.5

08 Sep 05:31
Compare
Choose a tag to compare
  • Add tvOS support (#69)

1.2.4

10 Aug 09:11
Compare
Choose a tag to compare
  • Check presented view controller first when finding a top most view controller (5dedbad)

1.2.3

10 Aug 09:10
Compare
Choose a tag to compare
  • Fix a bug that topMost returns wrong view controller on UIPageViewController (#63)

1.2.2

03 Jul 08:04
Compare
Choose a tag to compare
  • Add an exception handling for pushing/presenting an UINavigationController (#59)

1.2.1

04 Jun 18:21
Compare
Choose a tag to compare
  • Make UIViewController.topMost(of:) open (c86b5d8)