-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run-time Arguments in Swift #294
Comments
After doing some extra research it turned out, that assemblies with run-time arguments written in Swift are working well within the code in Run environment. So the reason why it all happened is incorrect creation of Assembly in Test environment. (ApplicationAssembly *)[TyphoonBlockComponentFactory factoryWithAssembly:[ApplicationAssembly assembly]]; So the only workaround I see for now, is to create some Objective-C helpers in Tests target that would only create Assemblies and then to use them in Swift tests. TestAssembliesHelper.h @interface TestAssembliesHelper : NSObject
+ (ApplicationAssembly *)applicationAssembly;
@end TestAssembliesHelper.m @implementation TestAssembliesHelper
+ (ApplicationAssembly *)applicationAssembly
{
return (ApplicationAssembly *)[TyphoonBlockComponentFactory factoryWithAssembly:[ApplicationAssembly assembly]];
}
@end Somewhere in tests let assembly = TestAssembliesHelper.applicationAssembly()
let requestCode = assembly.requestCodeApiGateway("1234567") as RequestCodeApiGateway
expect(requestCode).notTo(beNil())
expect(requestCode.phone).to(equal("1234567")) Actually it's fine for me as it still works out-of-box in Run environment, but it would be interesting to know if there are any other solutions to this problem. |
Hello Alexander, Yes, it's problem in Swift to cast TyphoonBlockComponentFactory into TyphoonAssembly (because Swift hasn't ducky typing support), but we did our main API using duck typing, so it's impossible to create factory using swift. We will fix that in future versions of typhoon (in typhoon 3.0) - requires rework main API.. |
Linked Issue: #253 |
Thank's a lot for your answer, and factory through plist - indeed! |
Hello,
I'm trying to implement assembly method that passes run-time argument into object constructor, but I'm stuck with several issues.
Assembly can't be casted from factory in Swift like in Objective-C as described here: TyphoonAssemblyActivator #253
Here I'm getting Thread 1: signal SIGABRT when trying to cast with
as
.Real example:
RequestCodeApiGateway.swift
RequestCodeApiGatewayImpl.swift
ApplicationAssembly.swift
Somewhere in tests
P.S. I've also tried to implement assembly in Objective-C and to leave the rest in Swift, but I hadn't succeeded because of other 'Stopper' issues:
println(requestCode) results with next log:
po requestCode in debugger shows:
And exception log is here:
Could you please take a look and maybe there is something wrong in my implementation, or there is an issue within Typhoon's framework so it could be unveiled and fixed?
P.P.S. issue is reproduced on 2.3.2 version
The text was updated successfully, but these errors were encountered: