WLRRoute
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Installation
WLRRoute is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "WLRRoute"
Architecture
中文介绍
WLRRoute是一个简单的iOS路由组件
详情请移步文章介绍:
移动端路由层设计
一步步构建iOS路由
本代码会随着大家的讨论逐步更新,喜欢的来个星
self.router = [[WLRRouter alloc]init];
[self.router registerHandler:[[WLRSignHandler alloc]init] forRoute:@"/signin/:phone([0-9]+)"];
[self.router handleURL:[NSURL URLWithString:@"WLRDemo://com.wlrroute.demo/signin/13812345432"] primitiveParameters:nil targetCallBack:^(NSError *error, id responseObject) {
NSLog(@"SiginCallBack");
} withCompletionBlock:^(BOOL handled, NSError *error) {
NSLog(@"SiginHandleCompletion");
}];
[self.router registerHandler:[[WLRUserHandler alloc]init] forRoute:@"/user"];
[self.router handleURL:[NSURL URLWithString:@"WLRDemo://com.wlrroute.demo/user"] primitiveParameters:@{@"user":@"Neo~🙃🙃"} targetCallBack:^(NSError *error, id responseObject) {
NSLog(@"UserCallBack");
} withCompletionBlock:^(BOOL handled, NSError *error) {
NSLog(@"UserHandleCompletion");
}];
Author
Neo, [email protected]
License
WLRRoute is available under the MIT license. See the LICENSE file for more info.