jjzjj

TyphoonComponentFactory

全部标签

ios - 用台风注入(inject)模拟

我正在尝试编写XCTest并使用Typhoon注入(inject)模拟依赖。这是我的ViewController中的代码:-(instancetype)init{self=[superinit];MDMainAssembly*assembly=(MDMainAssembly*)[TyphoonComponentFactorydefaultFactory];self.alertManager=[assemblyalertManager];returnself;}以下是我尝试更改注入(inject)的方式:self.mockedAlertManager=mock([MDAlertManag

ios - 台风 - 在整个应用程序中使用一个组件工厂

我正在plist中配置初始程序集,用于实例化Storyboard中的第一个Controller。稍后在应用程序中,我将使用以下方法更改RootViewController:TyphoonStoryboard*storyboard=[TyphoonStoryboardstoryboardWithName:storyboardTypefactory:factorybundle:nil];UIViewController*newRootView=[storyboardinstantiateViewControllerWithIdentifier:identifier];self.window

swift - 是否可以在 Typhoon 中注册协议(protocol)以快速与 TyphoonComponentFactory.componentForType 一起使用

TyphoonComponentFactoryProtocol.componentForType(classOrProtocol:AnyObject!)无法接受协议(protocol)据我所知,MyProtocol.self返回一个协议(protocol),而协议(protocol)似乎没有实现AnyObject协议(protocol)(仅Any)。有没有办法在swift中基于协议(protocol)使用Typhoon进行服务定位(而不是直接调用汇编函数),或者这只是目前swift和typhoon的限制? 最佳答案 不幸的是,这个方