UINavigationController wrapper with more logical way of viewControllers routing
KSRouter works with iOS8+ versions with ARC.
Add the next line info your Podfile:
pod 'KSRouter', :git => 'https://github.com/krin-san/KSRouter.git'
Include the main header file where you need:
#include <KSRouter/KSRouter.h>
Copy a KSRouter folder into your project and include the main header file where you need
#include "KSRouter.h"
Subclass your NavigationController (which is supposed to be a router) from KSRouterNavigationController:
@interface SidebarRouter : KSRouterNavigationController
@end
@implementation SidebarRouter
@synthesize routerId = _routerId;
@synthesize routes = _routes;
- (void)configureRouter {
_routerId = @"sidebar";
NSMutableArray *routes = [NSMutableArray array];
[routes addObject:[KSRouterItem itemWithStoryboardID:NSStringFromClass([SidebarItemFirst class])]];
[routes addObject:[KSRouterItem itemWithStoryboardID:NSStringFromClass([SidebarItemSecond class])]];
...
_routes = [routes copy];
[super configureRouter];
}
- (NSString *)initialRouteKey {
return ((KSRouterItem *)_routes.firstObject).key;
}
@end
Three closed-source projects with the names I can't tell
This code is distributed under the terms and conditions of the MIT license.