Zuikyo / ZIKRouter

Interface-oriented router for discovering modules, and injecting dependencies with protocol in Objective-C and Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

will zikrouter provide an api to shutdown the ZIKROUTER_CHECK function

manajay opened this issue · comments

whenever developing a component ,i found it's hard to run the demo of the component because of checking the missing protocol function. Especially when cycle dependency appears.

commented

If you're developing a component and don't need to test it's dependency, you can use fake class as dependency in demo or unit test. Like this:

@protocol DependencyViewInput1 <ZIKViewRoutable>
@end

@protocol DependencyViewInput2 <ZIKViewRoutable>
@end
@interface FakeViewController: UIViewController <DependencyViewInput1, DependencyViewInput2>
@end
@implementation FakeViewController
@end
@implementation DependencyRouteAdapter

+ (void)registerRoutableDestination {
    [ZIKViewRouter registerViewProtocol:ZIKRoutable(DependencyViewInput1) forMakingView:[FakeViewController class]];
    [ZIKViewRouter registerViewProtocol:ZIKRoutable(DependencyViewInput2) forMakingView:[FakeViewController class]];
}

@end

Or you can change Xcode's default value for macro DEBUG in Build Settings->Preprocessor Macros. When DEBUG=0, ZIKROUTER_CHECK is disabled.

commented

I will add better support for modifing ZIKROUTER_CHECK macro value in next version.

thanks