Latest 0.1.1
License MIT
Platforms ios 7.0, requires ARC

A URL Router who parse url use regex express for iOS. Inspired by HHRouter


Warm Up

Map URL patterns to a block.

GMRouter *router = [GMRouter shared];
GMRouterBlock block = ^(NSDictionary *params) {
    NSLog(@"%@", params[@"uid"]);
    NSLog(@"%@", params[@"pid"]);

[router map:@"/gemini/[uid]/[pid]" toBlock:block];

What we get next

Get the block and parameters when request a url

GMRouterBlock newBlock = [router matchBlock:@"/gemini/123/23423?hello=world"];

We will get the params in block.

How about Controller

GMRouter *router = [GMRouter shared];
[router map:@"/q/[questionId]" toControllerClass:[UIViewController class]];
UIViewController *controller = [router matchViewController:@"/q/1000010000?__ea=111"];
XCTAssertEqualObjects(controller.params[@"questionId"], @"1000010000");

Latest podspec

    "name": "GMRouter",
    "version": "0.1.1",
    "summary": "A not boring url parser",
    "description": "Not boring about query in url",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Gemini Wen": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.1"
    "social_media_url": "",
    "platforms": {
        "ios": "7.0"
    "requires_arc": true,
    "source_files": "GMRouter/*"

Pin It on Pinterest

Share This