Latest 1.0.1
Homepage https://github.com/aopod/AOPRouter
License MIT
Platforms ios 8.0
Authors

A URL routing solution for iOS. With features such as:

  • Autocomplete
  • Comment available
  • Duplication check
  • Miss handler
  • Simple Public/Private access control
  • Xcode friendly
  • etc.

Usage Examples

Declare routes

@interface AOPRouterHandler (Blog)

/**
 Open my blog
 aop://blog/open
 */
@AOPRouterMethodName(aop,blog,open);

/**
 Redirect to aop://blog/open
 */
@AOPRouterMethodName(aop,blog,redirect);

@end

@implementation AOPRouterHandler (Blog)

- AOPRouterMethodImpl(+,aop,blog,open)
{
    [UIApplication.sharedApplication openURL:[NSURL URLWithString:@"http://www.aopod.com"]];
}

- AOPRouterMethodImpl(+,aop,blog,redirect)
{
    context.url = [NSURL URLWithString:kAOPRouterPath(aop_blog_open)];
    [AOPRouter openInternalWithContext:context];
}

@end

Get parameters

- AOPRouterMethodImpl(-,aop,log)
{
    NSString *message = context.parameters[@"message"];
    NSLog(@"log a message: %@", message);
}

Call routes

[AOPRouter open:kAOPRouterPath(aop_blog_open)];

[AOPRouter open:@"aop://blog/open"];

[AOPRouter openInternal:kAOPRouterPath(aop_log)
                     parameters:@{
                                  @"message": @"Hello, World!"
                                  } animated:NO];

AOPRouterOpen(aop_blog_redirect);

Declare miss handlers

AOPRouterMissHandler(aop)
{
    NSLog(@"Miss handler: %s", __FUNCTION__);
    return YES;
}

AOPRouterMissHandler(aop,log)
{
    NSLog(@"Miss handler: %s", __FUNCTION__);
    return YES;
}

More Examples

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

AOPRouter is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'AOPRouter'

Author

aopodcom, [email protected]

License

AOPRouter is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "AOPRouter",
    "version": "1.0.1",
    "summary": "A URL routing solution for iOS",
    "description": "A URL routing solution for iOS. With features such as autocomplete, comment, duplication check, miss handler, etc.",
    "homepage": "https://github.com/aopod/AOPRouter",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "aopod": "[email protected]"
    },
    "source": {
        "git": "https://github.com/aopod/AOPRouter.git",
        "tag": "1.0.1"
    },
    "social_media_url": "http://www.aopod.com",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "AOPRouter/**/*"
}

Pin It on Pinterest

Share This