All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
TyphoonAssembly Class Reference

Provides a concise way to declare and encapsulate the architecture of an application in one or more classes that describe how components collaborate together. More...

Inheritance diagram for TyphoonAssembly:

Class Methods

(instancetype) + assembly
 
(instancetype) + defaultAssembly
 Returns the [TyphoonComponentFactory defaultFactory] posing as a TyphoonAssembly. More...
 

Instance Methods

(instancetype) - activate
 Activates the assembly. More...
 
(instancetype) - activateWithCollaboratingAssemblies:
 Activates the assembly, explicitly setting the types for collaborating assemblies. More...
 
- Instance Methods inherited from <TyphoonComponentFactory>
(NSArray *) - allComponentsForType:
 Returns an array objects matching the given type. More...
 
(void) - attachPostProcessor:
 Attach a TyphoonComponentFactoryPostProcessor to this component factory. More...
 
(id) - componentForKey:
 Returns the component matching the given key. More...
 
(id) - componentForKey:args:
 
(id) - componentForType:
 Returns an an instance of the component matching the supplied class or protocol. More...
 
(void) - inject:
 Injects the properties and methods of an object. More...
 
(void) - inject:withSelector:
 Injects the properties and methods of an object, described in definition. More...
 
(void) - makeDefault
 

Detailed Description

Provides a concise way to declare and encapsulate the architecture of an application in one or more classes that describe how components collaborate together.

Prior to activation the assembly interface returns TyphoonDefinitions. After activation assembly interface poses in of a TyphoonComponentFactory to return built instances.

Example:

MyAssembly* assembly = [[MyAssembly new] activate];
AnalyticsService* service = [assembly analyticsService];

The TyphoonAssembly provides:

  • a way to easily define multiple components of the same class or protocol
  • Avoids the use of "magic strings" for component resolution and wiring
  • Allows the use of IDE features like refactoring and code completion.

Method Documentation

- (instancetype) activate

Activates the assembly.

The concrete declared type of any collaborating assemblies will be used. If collaborating assemblies are backed by a protocol then they must be specified explicitly.

See also
activateWithCollaboratingAssemblies
- (instancetype) activateWithCollaboratingAssemblies: (NSArray *)  assemblies

Activates the assembly, explicitly setting the types for collaborating assemblies.

Parameters
assembliesThe explicit types to be used for collaborating assemblies. For example if this assembly references another assembly of type NetworkProvider, specifying a subclass TestNetworkProvider will override the base type. If collaborating assemblies are backed by a protocol, they must be specified explicitly.
+ (instancetype) assembly
+ (instancetype) defaultAssembly

Returns the [TyphoonComponentFactory defaultFactory] posing as a TyphoonAssembly.