All Projects → lightory → Hhrouter

lightory / Hhrouter

Licence: mit
Yet another URL Router for iOS.

Programming Languages

objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Hhrouter

CRRouter
A simple and powerful router
Stars: ✭ 54 (-96.65%)
Mutual labels:  url-router
js-flask-urls
Client-side Flask URL building
Stars: ✭ 21 (-98.7%)
Mutual labels:  url-router
WaterPipe
URL routing framework, requests/responses handler, and HTTP client for PHP
Stars: ✭ 24 (-98.51%)
Mutual labels:  url-router
goblin
A golang http router based on trie tree.
Stars: ✭ 52 (-96.77%)
Mutual labels:  url-router

HHRouter

Build Status CocoaPods

Yet another URL Router for iOS. Clean, Fast & Flexible. Inspired by ABRouter & Routable iOS.

Usage

Warm Up

Map URL patterns to viewController. Better in AppDelegate.

[[HHRouter shared] map:@"/user/:userId/" toControllerClass:[UserViewController class]];

Exciting Time

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

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");

One More Thing

If your app has defined some URL schemes, HHRouter will know.

UIViewController *viewController = [[HHRouter shared] matchController:@"hhrouter://user/1/"];
XCTAssertEqualObjects([viewController class], [UserViewController class]);

Installation

CocoaPods

pod 'HHRouter', '~> 0.1.8'
#import <HHRouter/HHRouter.h>

If you're not able to use CocoaPods, please install HHRouter as a git submodule and add the files to your Xcode project.

We're Hiring!

http://pudding.cc/opportunity/

Contact

Who use HHRouter?

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.

License

HHRouter is available under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].