zuikyo / zikrouter Goto Github PK
View Code? Open in Web Editor NEWInterface-oriented router for discovering modules, and injecting dependencies with protocol in Objective-C and Swift.
License: MIT License
Interface-oriented router for discovering modules, and injecting dependencies with protocol in Objective-C and Swift.
License: MIT License
请问混编的话是否需要 ZIKRouter 和 ZRouter 都要导入?
router's action (ZIKRouteActionPerformRoute) catch error: (Error Domain=kZIKViewRouteErrorDomain Code=4 "Unbalanced calls to begin/end appearance transitions for destination. This error occurs when you try and display a view controller before the current view controller is finished displaying. This may cause the UIViewController skips or messes up the order calling -viewWillAppear:, -viewDidAppear:, -viewWillDisAppear: and -viewDidDisappear:, and messes up the route state. Current error reason is already removed destination but destination appears again before -viewDidDisappear: 请问这个是什么原因?
老铁,你能不能搞一个好一点的demo
I plan to use this framework in my Mac & iOS projects, so are you planing to support OS X?
当router支持的路由类型是ZIKViewRouteTypeMaskViewDefault时Presenter如果强持有router会造成view的内存泄漏,这种情况下我觉得是router强制持有了绑定的view。我查看了一下源码,仍然没有找到问题的原因,希望大神指点,另外当router绑定的是controller类型时是正常的,view presenter Interactor 等的持有关系我反复核查过,问题并不出现在这个地方。谢谢
The operation couldn’t be completed. (IDEFoundation.IDETemplateParseError error 1.)
"_ZIKRouteActionPerformRoute", referenced from:
closure #1 (A) -> () in ZRouter.ViewRouterType.perform(path: ZRouter.ViewRoutePath, completion: (Swift.Bool, A?, __C.ZIKRouteAction, Swift.Error?) -> ()) -> ZRouter.ViewRouter<A, B>? in ViewRouter.o
closure #1 (A) -> () in ZRouter.ViewRouter.performRoute(completion: (Swift.Bool, A?, __C.ZIKRouteAction, Swift.Error?) -> ()) -> () in ViewRouter.o
closure #1 (A) -> () in ZRouter.ServiceRouterType.perform(completion: (Swift.Bool, A?, __C.ZIKRouteAction, Swift.Error?) -> ()) -> ZRouter.ServiceRouter<A, B>? in ServiceRouter.o
closure #1 (A) -> () in ZRouter.ServiceRouter.performRoute(completion: (Swift.Bool, A?, __C.ZIKRouteAction, Swift.Error?) -> ()) -> () in ServiceRouter.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'd like to create a global injection method in + (void)AOP_notifyAll_router:(nullable ZIKViewRouter *)router willPerformRouteOnDestination:(id)destination fromSource:(nullable id)source
.But there is no URL information in params.
请参阅ZIKRouter初学者入门实践Demo
你的中文文档中,没有EditorDelegate的定义,请问怎么定义?
比如有两个模块,PostModule和PersonModule,两个模块间无耦合,业务交集通过Provider接口层提供。主APP通过pod引入两个模块,但这样的话主app是可以引用到模块下的所有类的,在APP中就有可能引入模块中的某个类导致与APP耦合。
Undefined symbols for architecture arm64:
"___cxa_demangle", referenced from:
-[NSString(Demangle) demangledAsCPP] in libZIKRouter.a(NSString+Demangle.o)
"std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::__init(char const*, unsigned long)", referenced from:
_demangleSymbolAsString(char const*, unsigned long, DemangleOptions const&) in libZIKRouter.a(NSString+Demangle.o)
"std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::~basic_string()", referenced from:
-[NSString(Demangle) demangledAsSwift] in libZIKRouter.a(NSString+Demangle.o)
-[NSString(Demangle) demangledAsSimplifiedSwift] in libZIKRouter.a(NSString+Demangle.o)
"___gxx_personality_v0", referenced from:
+[ZIKImageSymbol enumerateImages:] in libZIKRouter.a(ZIKImageSymbol.o)
+[ZIKImageSymbol findSymbolInImage:name:] in libZIKRouter.a(ZIKImageSymbol.o)
+[ZIKImageSymbol findSymbolInImage:matching:] in libZIKRouter.a(ZIKImageSymbol.o)
-[NSString(Demangle) demangledAsSwift] in libZIKRouter.a(NSString+Demangle.o)
_demangleSymbolAsString(char const*, unsigned long, DemangleOptions const&) in libZIKRouter.a(NSString+Demangle.o)
-[NSString(Demangle) demangledAsSimplifiedSwift] in libZIKRouter.a(NSString+Demangle.o)
-[NSString(Demangle) demangledAsCPP] in libZIKRouter.a(NSString+Demangle.o)
...
ld: symbol(s) not found for architecture arm64
Demo编译报错
你好 我用makeDestination 获取子模块view时崩溃 检查源码是- (void)_performGetDestination:(id)destination fromSource:(nullable id)source函数中self.stateBeforeRoute = [destination zix_presentationState];造成的,因为zix_presentationState成controller分类中的扩展方法。然而我们在获取模块的时候这个模块可能是controller 也可能是view 不应该只是controller,希望您能给出解决方案,最后我想说的是 我爱死你这套路由方案了!!!
作者您好,能ReadMe写一下,下载demo怎么运行吗?我打开文件夹有点懵。
+ (void)registerViewProtocol:(Protocol *)viewProtocol {
NSAssert(!ZIKViewRouteRegistry.registrationFinished, @"Only register in +registerRoutableDestination.");
#if ZIKROUTER_CHECK
NSAssert1(protocol_conformsToProtocol(viewProtocol, @protocol(ZIKViewRoutable)), @"%@ should conforms to ZIKViewRoutable in DEBUG mode for safety checking", NSStringFromProtocol(viewProtocol));
#endif
[ZIKViewRouteRegistry registerDestinationProtocol:viewProtocol router:self];
}
.h 文件
#import "ZIKViperRouter.h"
#import <ZIKRouter/ZIKViewRoute.h>
#import <Foundation/Foundation.h>
@interface LSRecommendListWireFrame : ZIKViewRouter <ZIKViperRouter>
@end
#import "ZIKViewRouter+ZIKViper.h"
#import "ZIKViperViewPrivate.h"
#import <ZIKRouter/ZIKRouter.h>
#import <ZIKRouter/ZIKRouterInternal.h>
#import "LSRecommendListWireFrame.h"
#import "LSRecommendListInteractor.h"
#import "LSRecommendListPresenter.h"
#import "LSRecommendListController.h"
#import "LSRemoteCourseDataManager.h"
#import "LSDeviceClock.h"
#import "LSRouterConst.h"
#import "LSRecommendListViewInterface.h"
@interface LSRecommendListController (LSRecommendListWireFrame) <ZIKRoutableView>
@end
@implementation LSRecommendListController (LSRecommendListWireFrame)
@end
@interface LSRecommendListWireFrame ()
@end
@implementation LSRecommendListWireFrame
+ (void)registerRoutableDestination {
[self registerView:[LSRecommendListController class]];
[self registerViewProtocol:ZIKRoutable(LSRecommendListViewInterface)];
[self registerIdentifier:HomeMatchSymbol];
}
- (UIViewController *)destinationWithConfiguration:(ZIKViewRouteConfiguration *)configuration {
LSRecommendListController *listViewController = [[LSRecommendListController alloc] init];
return listViewController;
}
- (BOOL)destinationFromExternalPrepared:(id)destination {
NSParameterAssert([destination isKindOfClass:[LSRecommendListController class]]);
NSParameterAssert([destination conformsToProtocol:@protocol(ZIKViperViewPrivate)]);
if (![ZIKViewRouter isViperAssembledForView:destination]) {
return NO;
}
return YES;
}
- (void)prepareDestination:(id)destination configuration:(__kindof ZIKViewRouteConfiguration *)configuration {
NSParameterAssert([destination isKindOfClass:[LSRecommendListController class]]);
NSParameterAssert([destination conformsToProtocol:@protocol(ZIKViperViewPrivate)]);
if (![self isViperAssembled]) {
[self assembleViper];
} else {
[self attachRouter];
}
}
#pragma mark Viper assembly
- (void)assembleViper {
id<ZIKViperViewPrivate> view = self.destination;
NSAssert(view, @"Can't assemble viper when view is nil");
LSRemoteCourseDataManager *dataManager = [[LSRemoteCourseDataManager alloc] init];
LSDeviceClock *clock = [[LSDeviceClock alloc] init];
LSRecommendListPresenter *presenter = [[LSRecommendListPresenter alloc] init];
LSRecommendListInteractor *interactor = [[LSRecommendListInteractor alloc] initWithRemoteDataManager:dataManager clock:clock];
interactor.output = presenter;
[self assembleViperForView:view
presenter:(id<ZIKViperPresenterPrivate>)presenter
interactor:interactor];
}
- (void)attachRouter {
id<ZIKViperViewPrivate> view = self.destination;
NSAssert(view, @"Can't assemble viper when view is nil");
[self attachRouterForView:view];
}
#pragma mark AOP
+ (void)router:(ZIKViewRouter *)router willPerformRouteOnDestination:(id)destination fromSource:(id)source {
NSAssert([ZIKViewRouter isViperAssembledForView:destination], @"Viper should be assembled");
}
@end
协议
#import <Foundation/Foundation.h>
#import <ZIKRouter/ZIKRouter.h>
@protocol LSRecommendListViewInterface <NSObject>
@end
这个怎么回事
swift语言版本能支持到5.0吗
业务模块之间的通讯无法无法独立,按照你方式,因为他必须得需要知道协议,要不然编译都无法通过,那么协议又该放到哪呢?如果放到本库中,那么其他库用到就得依赖本库,除非协议单独提出来,如果协议单独提出来,按照你的设计思路,协议会很多?
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.
这个项目后续还会继续维护么
请问一下这个具体是什么原因, 找了挺久的, 大神帮我看看
2018-09-27 22:38:54.110016+0800 iOS-More[56319:8936026] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The router (XMDModulesViewRouter) doesn't support makeDestination'
*** First throw call stack:
(
0 CoreFoundation 0x000000010abbf29b __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010a157735 objc_exception_throw + 48
2 CoreFoundation 0x000000010abbf022 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000109b5bb47 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 ZIKRouter 0x00000001099d27c6 +[ZIKRouter makeDestinationWithConfiguring:] + 694
5 ZIKRouter 0x0000000109a013f5 +[ZIKViewRouter makeDestinationWithConfiguring:] + 517
还有一个疑问: 界面路由 与 界面模块路由, 其实两者之间的区别, 除了模块解耦, 那项目中, 具体说如何选用, 打个比方, 一个 tarbar 可以说更对应一个 界面模块路由吧?
if use performURL it work well. but if use perform method it does not work.
let url = "abc://bvc/a?title=1"
// ZIKAnyViewRouter.performURL(url, path: ZIKViewRoutePath.push(from: self))
let b = ZIKAnyViewRouter.router(forURL: url)
b?.perform(ZIKViewRoutePath.push(from: self), configuring: { (config) in
print("config:\(config.userInfo)")
// config.addUserInfo(<#T##userInfo: [String : Any]##[String : Any]#>)
config.prepareDestination = { destination in
if let destination = destination as? UIViewController{
destination.modalPresentationStyle = .overFullScreen
}
}
})
在 WKWebView 中的输入框输入表情之后,收起键盘出现闪退
*** Assertion failure in -[UIKeyboardMediaServiceRemoteViewController willMoveToParentViewController:]
ZIKRouter/ZIKRouter/ViewRouter/ZIKViewRouter.m:2112
"0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350",
"1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48",
"2 CoreFoundation 0x00007fff23c70ff8 +[NSException raise:format:arguments:] + 88",
"3 Foundation 0x00007fff256e9b51 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:descript
"4 ZIKRouter 0x000000010f6f46df -[ZIKViewRouter ZIKViewRouter_hook_willMoveToParentViewController:] + 399"
"5 UIKitCore 0x00007fff47b2cb4c -[UIKeyboardMediaController releaseRecentlyUsedMediaViewIfNeeded] + 46",
"6 UIKitCore 0x00007fff47e96539 -[UIKeyboardImpl setDelegate:force:] + 4931",
"7 UIKitCore 0x00007fff47b56c12 -[UIInputResponderController _reloadInputViewsForKeyWindowSceneResponder:]
"8 UIKitCore 0x00007fff47b563b3 -[UIInputResponderController _reloadInputViewsForResponder:] + 144",
"9 UIKitCore 0x00007fff480c4c8b -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 133",
"10 WebKit 0x00007fff2d46821b -[WKContentView(WKInteraction) _hideKeyboard] + 106",
"11 WebKit 0x00007fff2d468c54 -[WKContentView(WKInteraction) _elementDidBlur] + 296",
"12 WebKit 0x00007fff2cf4582e _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_7Decoder
"13 WebKit 0x00007fff2d190448 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7De
"14 WebKit 0x00007fff2cf31802 _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_7DecoderENS1_1
"15 WebKit 0x00007fff2cf345a4 _ZN3IPC10Connection24dispatchIncomingMessagesEv + 408",
"16 JavaScriptCore 0x00007fff268a11f4 _ZN3WTF7RunLoop11performWorkEv + 228",
"17 JavaScriptCore 0x00007fff268a1482 _ZN3WTF7RunLoop11performWorkEPv + 34",
"18 CoreFoundation 0x00007fff23bd4471 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17",
"19 CoreFoundation 0x00007fff23bd439c __CFRunLoopDoSource0 + 76",
"20 CoreFoundation 0x00007fff23bd3b74 __CFRunLoopDoSources0 + 180",
"21 CoreFoundation 0x00007fff23bce87f __CFRunLoopRun + 1263",
"22 CoreFoundation 0x00007fff23bce066 CFRunLoopRunSpecific + 438",
"23 GraphicsServices 0x00007fff384c0bb0 GSEventRunModal + 65",
"24 UIKitCore 0x00007fff48092d4d UIApplicationMain + 1621",
"25 HuoBan_DEBUG 0x000000010bc7e300 main + 112",
"26 libdyld.dylib 0x00007fff5227ec25 start + 1"
各种功能杂糅到一起,没有一个统一的头文件,比如ZIKRouterToView 引用ZIKRouter 找不到,竟然再另外一个分类里
iOS 13 获取window方案调整了希望可以修复一下zix_isAppRootViewController
有一些不需要参数的页面,都必须创建 ZIKViewRouter 的子类 才能实现 URL Route ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.