NSObject(FactoryHooks)
@interface NSObject (FactoryHooks)
/////////////////////////////////////////////////////////////////////////////
-
- Accepts the TyphoonComponentFactory via setter-injection, allowing the factory to be stored to a property or ivar. Note that this method
- contract uses the type id, which if you’re using a block-style assembly allows setting the factory to the TyphoonAssembly sub-class
- itself without casting. The underlying type is TyphoonComponentFactory. *
- ##Examples:
//Using the TyphoonComponentFactory interface: - (void)typhoonSetFactory:(TyphoonComponentFactory*)factory { _factory = factory; MyAnalyticsService* service = [factory componentForType:[MyAnalyticsService class]; }
//Using an Assembly interface - (void)typhoonSetFactory:(MyAssemblyType*)assembly { _assembly = assembly; MyAnalyticsService* service = [assembly analyticsService]; }
- - note: Whether the factory is injected as a TyphoonComponentFactory or a TyphoonAssembly sub-class, it can still be casted from one to the
- other.
Declaration
Objective-C
- (void)typhoonSetFactory:(id)theFactory;
-
Typhoon calls this method (if implemented) just before property and method injections
Declaration
Objective-C
- (void)typhoonWillInject;
-
Typhoon calls this method (if implemented) just after property and method injections
Declaration
Objective-C
- (void)typhoonDidInject;