-
Notifications
You must be signed in to change notification settings - Fork 269
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
Swift inject .property of another component doesn't work (has workarounds) #245
Comments
Hi, @RobbieBubble your code seems to be right. Looks like our "property" feature doesnt work for Swift assmebly. Can you try next code: public func dbManagerFactory() -> AnyObject {
var definitionBlock : TyphoonDefinitionBlock = {(definition : TyphoonDefinition!) in
definition.userInitializer("sharedInstance")
return TyphoonDefinition.withClass(CBLManager.classType(), configuration: definitionBlock)
} |
@alexgarbarev according injection code
|
@RobbieBubble Instead of using value for key, try declaring the method with the dynamic attribute. Works great. |
Let's retest for Typhoon 3.1 and Swift 1.2 |
Closing due to inactivity. If you still experience this issue, feel free to reopen it. |
hi all,
i have to wire an instance created by a singleton
CBLManager.sharedInstance()
. I tried to adapt your guideline "[Injecting objects produced by other components](Injecting objects produced by other components)" but somehow i didn't get it to work. No error is thrown, just thedbManger
component isnil
in thelocalStorageService
.I also tried the
valueForKey(key)
approachdefinition.injectProperty("dbManager", with: self.valueForKey("dbManagerFactory").property("sharedInstance"))
but this just gives me anthis class is not key value coding-compliant for the key sharedInstance
errorAs a workaround i placed the
CBLManager.sharedInstance()
call directly in the definition.definition.injectProperty("dbManager", with: CBLManager.sharedInstance())
. Doesn't feel right and i'm not sure if this is causing any other problems but at least thedbManager
is setAssembly.swift
The text was updated successfully, but these errors were encountered: