GithubHelp home page GithubHelp logo

hhrouter's Introduction

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

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.

hhrouter's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.