typhoon

Typhoon : Obtain a Typhoon-built instance of a class without depending on Typhoon

我们两清 提交于 2020-01-25 10:58:06
问题 With Typhoon storyboard integration, all that is necessary for dependency injection is to use auto-injection macros or assembly methods on the class to be injected. However elsewhere, its necessary to ask Typhoon to build an instance for us. Is there a way to obtain an instance, without having my class depend on Typhoon? 回答1: Yes, in the spirit of dependency injection, Typhoon is designed so that its not necessary for any user classes to have a direct dependency on Typhoon. Let's say you wish

Typhoon: Assembly and Storyboard-Created ViewControllers

回眸只為那壹抹淺笑 提交于 2020-01-11 04:48:05
问题 How would I use Typhoon with iOS storyboards where view controllers are generated implicitly by the system? Would I have to do something special in the prepareForSegue methods? 回答1: It is very simple with TyphoonStoryboard By bootstrapping Typhoon in your plist, along with the usual UILaunchStoryboardName and UIMainStoryboardFile, Typhoon will ensure that all Storyboards are an instance of TyphoonStoryboard. Use exactly as you would a normal Storyboard, with the added benefit that

Typhoon loading storyboard programmatically appears to perform asynchronous instantiation without blocking

白昼怎懂夜的黑 提交于 2020-01-02 20:09:39
问题 I am developing an iOS application and am trying to integrate Typhoon into the testing. I am currently trying to mock out a dependency in a view controller that comes from the storyboard, so with in my assembly: public dynamic var systemComponents: SystemComponents! public dynamic func storyboard() -> AnyObject { return TyphoonDefinition.withClass(TyphoonStoryboard.self) { (definition) in definition.useInitializer("storyboardWithName:factory:bundle:") { (initializer) in initializer

Typhoon not injecting property (without storyboard)

a 夏天 提交于 2019-12-20 02:47:08
问题 I cannot get properties injected into view controllers using XIBs with initWithNibName:bundle: Example: This is my assembly: @implementation AppAssembly - (ViewControllerC *)viewControllerC { return [TyphoonDefinition withClass:[ViewControllerC class] configuration:^(TyphoonDefinition *definition) { [definition injectProperty:@selector(name) with:@"Injected string"]; }]; } @end ViewControllerA code: @implementation ViewControllerA - (IBAction)buttonAction:(id)sender { ViewControllerB

Factory initialization with additonal property injection

自古美人都是妖i 提交于 2019-12-13 02:22:01
问题 In my demo project I replaced the manual creation of a view controller with the factory-based creation within an assembly like so (as Jasper Blues demonstrated here: https://stackoverflow.com/a/24227246/397898) // ApplicationAssembly dynamic func mainStoryboard() -> AnyObject { return TyphoonDefinition.withClass(TyphoonStoryboard.self) { (definition) in definition.useInitializer("storyboardWithName:factory:bundle:") { (initializer) in initializer.injectParameterWith("Main") initializer

Bridging-header.h causes Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

≡放荡痞女 提交于 2019-12-11 13:35:54
问题 If i add this line to my PROJECT-Bridging-Header.h file #import "Typhoon.h" Xcode 6.1 throws this error /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1 Typhoon framework is added by CocoaPods exactly like in the tutorial I tried several thinks, but nothing helped Delete XCODE deriver data create new Project delete and create new bridging-header.h file 回答1: Ran across a similar kind of issue, needed to clean up the project

TyphoonPatcher for mocking in unit tests

回眸只為那壹抹淺笑 提交于 2019-12-10 22:58:02
问题 I have Assembly : @interface MDUIAssembly : TyphoonAssembly @property (nonatomic, strong, readonly) MDServiceAssembly *services; @property (nonatomic, strong, readonly) MDModelAssembly *models; - (id)choiceController; @end @implementation MDUIAssembly - (void)resolveCollaboratingAssemblies { _services = [TyphoonCollaboratingAssemblyProxy proxy]; _models = [TyphoonCollaboratingAssemblyProxy proxy]; } - (id)choiceController { return [TyphoonDefinition withClass:[MDChoiceViewController class]

Injecting mock with Typhoon

泪湿孤枕 提交于 2019-12-10 22:19:40
问题 I'm trying to write XCTest and inject mocked dependency with Typhoon. Here is code in my ViewController : - (instancetype)init { self = [super init]; MDMainAssembly *assembly = (MDMainAssembly *) [TyphoonComponentFactory defaultFactory]; self.alertManager = [assembly alertManager]; return self; } Here is how I'm trying to change injection: self.mockedAlertManager = mock([MDAlertManager class]); MDMainAssembly *assembly = [MDMainAssembly assembly]; TyphoonComponentFactory *factory =

Typhoon and @objc limitation in protocols

坚强是说给别人听的谎言 提交于 2019-12-10 19:44:59
问题 Is there like an official workaround with protocols and types that are not supported in Object C As an example, I have a protocol that returns a reactive cocoa signal producer public protocol PLoginService { func login(username:String,password:String) -> SignalProducer<Bool,NSError> } If I use @objc on the protocol, then I will get the compiler error that the return type is not supported in Objective C. I will have a lot of constructions like this, so I was wondering what I can do in order to

How to inject fake, stubbed or mock dependencies for Integration tests using Typhoon

别来无恙 提交于 2019-12-07 13:54:48
问题 I'm trying to write integration tests using KIF. My question is: How to inject stubbed, mock or fake dependency for particular view controller? Each view controller using dependencies like a data model, http client, store manager etc. comes from ModelAssembly, ApplicationAssembly, ManagerAssmebly. On storyboard, for login view i have a key path, containing value "loginViewController". Creating view controllers: ViewControllersAssembly.h @interface ViewControllersAssembly : TyphoonAssembly