TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jun 2016 |
Maintained by George Shen, Light, Elethom Hunter, Cee Cirno.
Yet another URL Router for iOS. Clean, Fast & Flexible. Inspired by ABRouter & Routable iOS.
Map URL patterns to viewController. Better in AppDelegate.
[[HHRouter shared] map:@"/user/:userId/" toControllerClass:[UserViewController class]];
Get viewController instance from URL. Params will be parsed automatically.
UIViewController *viewController = [[HHRouter shared] matchController:@"/user/1/"];
XCTAssertEqualObjects([viewController class], [UserViewController class]);
XCTAssertEqualObjects(viewController.params[@"route"], @"/user/1/");
XCTAssertEqualObjects(viewController.params[@"userId"], @"1");
URL Query Params is also supported, which will make things VERY flexible.
UIViewController *viewController = [[HHRouter shared] matchController:@"/user/1/?tabIndex=3"];
XCTAssertEqualObjects(viewController.params[@"tabIndex"], @"3");
If your app has defined some URL schemes, HHRouter will know.
UIViewController *viewController = [[HHRouter shared] matchController:@"hhrouter://user/1/"];
XCTAssertEqualObjects([viewController class], [UserViewController class]);
http://pudding.cc/opportunity/
If you're building your applications using HHRouter, please let me know! (add your application name & App Store link here and pull reuqest this README.
HHRouter is available under the MIT license.