2.0.0-beta.1 - Better Design
Pre-releaseWhile 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.