Skip to content

Releases: RakuyoKit/RaRouter

2.2.0 - Fix `Global` Error

09 Oct 03:38
Compare
Choose a tag to compare

Fix:

In versions 2.0.0 and 2.1.0, "Global" was not performing any routing correctly. This issue has been fixed in this version.

The implementation of this feature takes advantage of the dynamic nature of Objective-C, which may be known as "what goes around comes around".

Although routing can be performed directly through Router<Global>, as in version 1.x, the rules need to be followed when implementing routing.

Please refer to the demo for details.

2.1.0 - Adjust the Method of Executing Routing

09 Oct 03:30
Compare
Choose a tag to compare

Add

  1. Add the ability to route directly through strings. (This feature was not implemented due to an oversight at the time of the 2.x version coding.)

Change

  1. Add some basic routing methods to the RaRouter protocol. Now you can customize the implementation of these methods.

🤩 2.0.0

29 Sep 01:29
Compare
Choose a tag to compare

Version 2.0.0 is officially released. Please refer to the release notes of 2.0.0-beta.1 for changes.

2.0.0-beta.1 - Better Design

09 Sep 05:50
Compare
Choose a tag to compare
Pre-release

While using "RaRouter`1.x", we found a lot of problems, some of which were caused by some wrong design.

So in 2.x version, we have refactored some of the content and tried to fix some of the issues.

Version 2.0.0 is still in preparation, so if you have any suggestions, or if you find bugs, please let us know.

Change

The following changes are essentially to the definition of the module and require little or no change for the caller.

Version restrictions

The minimum version requirement for 2.x has now been raised to iOS 10..

Factory

Factory related content is the biggest change.

  • RouterFactory is now a protocol instead of a class.
  • FactoryMediator protocol has been added to decouple and register routes.
  • ModuleRouter adds an associated Factory type, following the RouterFactory protocol.

Table

  • RouterTableProtocol has been renamed to RouterTable.
  • String and String enumeration now follow RouterTable Protocol default.
  • RouterError has added an error of type tableNil.

Execute Router

  • the three ways of performing routing in RaRouter **no longer accept **String as a valid route url.
  • Also, the table parameter is marked as Optional. A RouterError.tableNil is thrown when the passed table is nil.

If you need to perform routing via the native string type, convert the type manually.
For example: Module.Table(rawValue: "your router url").

We are still evaluating this change. For more information, please refer to. #16

Initialize

  • Added NeedInitialized protocol.
  • Gave the RaRouter<Global>.initialize() method a completely different functionality than before.

The new version of RaRouter does not require additional registration logic**, i.e., there is no need to execute Router<Modules>.initialize() in the application(_:didFinishLaunchingWithOptions:) method.

That's a good thing, it means no extra code needs to be written.

But this also means a problem: the module has lost the ability to sense app startup.

While we can also use the "UIApplicationDidFinishLaunchingNotification" notification to sense that the app has finished launching, we wish there was a way for us to more accurately control this process.

So we provide the NeedInitialized protocol and the RaRouter<Global>.initialize() method.

TODO

Next, in addition to fixing bugs, we will focus more on how to simplify the definition of modules and how to improve routing performance.

These changes may be released with "2.0.0", or in a future "2.x" release.

1.4.0 - Get Results by Closure

07 Jul 02:59
Compare
Choose a tag to compare

Add

Now you can return the result of the route execution through the closure.

Try the following code (Take get as an example, The same method works for do and viewController):

  • Register route
Router<Examples>.register(for: "Examples") { (url, value, callback: @escaping GetResultCallback) in
            
    DispatchQueue.main.async {
        callback(.success("Examples String"))
    }
}
  • Execute route:
Router<Examples>.get(of: String.self, from: "Examples") { (result) in
            
    switch result {
    case .success(let string):
        print(string)
                
    case .failure(let error):
        print(error)
    }
}

1.3.0 - More Robust Error handling

02 Jun 05:36
Compare
Choose a tag to compare

Add

We have added two new error types to RouterError:

  1. resultNil: The returned result is nil.
  2. other: Other types of errors

We provide detailed documentation, please refer to code for more content.

1.2.1 - Fix `Get` Error

26 Apr 09:19
Compare
Choose a tag to compare

Add

  • RouterError complies with Equatable. (Note: this may change at any time, if you have a better idea, welcome to suggest issus)

Change:

  • Now when registering a get type route, the return value of the closure is changed from GetResult<T> to GetResult<AnyResult> (GetResult <Any?>)

Fix:

  • Fixed a crash when registering Get routes.

1.2.0 - Default Value for `Get`

20 Apr 02:46
Compare
Choose a tag to compare

Add

Added get (default:) method for get.

Now when we call the get method, we can use this method to provide a default value instead of try?

let string: String = Router<Global>.get(of: String.self, from: "router").get(default: "defaultString")

1.1.0 - Breaking Change

17 Apr 05:58
Compare
Choose a tag to compare

Change

  1. When execute router, Use Result instead of throws.
  2. getResult() is now renamed to get().
  3. Added type parameter to get to convert the type of result inside the method.
  4. Adjust the method declarations of get and viewController. Please check the code for details.

At the same time, we have updated the supporting demo and wiki. For more detailed modification and usage, please refer to the above content.

1.0.1 - iOS 9 !

15 Apr 03:29
Compare
Choose a tag to compare

Change

  • Now RaRouter supports from iOS 9! 🤣