CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

AOPRouter 1.0.1

AOPRouter 1.0.1

Maintained by aopod.



AOPRouter 1.0.1

AOPRouter

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.