Releases: RakuyoKit/RaRouter
2.2.0 - Fix `Global` Error
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
Add
- 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
- Add some basic routing methods to the
RaRouter
protocol. Now you can customize the implementation of these methods.
🤩 2.0.0
2.0.0-beta.1 - Better Design
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 associatedFactory
type, following theRouterFactory
protocol.
Table
RouterTableProtocol
has been renamed toRouterTable
.String
andString enumeration
now followRouterTable
Protocol default.RouterError
has added an error of typetableNil
.
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 asOptional
. ARouterError.tableNil
is thrown when the passedtable
isnil
.
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 executeRouter<Modules>.initialize()
in theapplication(_: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 theRaRouter<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
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
Add
We have added two new error types to RouterError
:
resultNil
: The returned result is nil.other
: Other types of errors
We provide detailed documentation, please refer to code for more content.
1.2.1 - Fix `Get` Error
Add
RouterError
complies withEquatable
. (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>
toGetResult<AnyResult>
(GetResult <Any?>
)
Fix:
- Fixed a crash when registering
Get
routes.
1.2.0 - Default Value for `Get`
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
Change
- When execute router, Use
Result
instead ofthrows
. getResult()
is now renamed toget()
.- Added
type
parameter to get to convert the type of result inside the method. - Adjust the method declarations of
get
andviewController
. 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 !
Change
- Now
RaRouter
supports from iOS 9! 🤣