appsquickly / typhoon

Powerful dependency injection for Objective-C ✨✨ (https://PILGRIM.PH is the pure Swift successor to Typhoon!!)✨✨
https://pilgrim.ph
Apache License 2.0
2.7k stars 270 forks source link

Collaborating Assemblies not initialized #561

Closed msalmanST closed 7 years ago

msalmanST commented 7 years ago

Hi,

So I stuck in an issue where I have 3 assemblies, let say appAssembly,uiAssembly and coreAssembly. 'appAssembly' keeps the instance of 'uiAssembly' and 'coreAssembly'. I am using plist to initialize the assemblies and they appears in order

appAssembly uiAssembly coreAssembly (I also try to change the order in plist but didn't help.

Now I want to inject coreAssembly and uiAssembly in appdelegate, so the code looks like below

public dynamic func appDelegate() -> Any {
        return TyphoonDefinition.withClass(AppDelegate.self){
            (definition) in

            definition?.injectProperty(#selector(getter: AppDelegate.appUIComponents), with: self.appUICompnents)
            definition?.injectProperty(#selector(getter: AppDelegate.coreComponents), with: self.appCoreComponentsAssembly)
        }
    }

My code is crashing while injecting properties in appdelegate. seems appUIComponents and coreComponents objects are not initialized yet.

msalmanST commented 7 years ago

I found the issue, I wasn't using the dynamic keyword with the assembly object.

jasperblues commented 7 years ago

👍