Skip to content
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

Make TyphoonAssemblyActivator implicit #339

Closed
jasperblues opened this issue Apr 14, 2015 · 1 comment
Closed

Make TyphoonAssemblyActivator implicit #339

jasperblues opened this issue Apr 14, 2015 · 1 comment

Comments

@jasperblues
Copy link
Member

Rather than instantiating an activator like:

MiddleAgesAssembly *assembly = [MiddleAgesAssembly assembly];
[[TyphoonAssemblyActivator withAssemblies:@[assembly, anotherAssembly]] activate];

Then allow:

//This activates using the concrete collaborator classes specified in properties
MiddleAgesAssembly *assembly = [[MiddleAgesAssembly assembly] activate];

//This activates overriding a concrete collaborator class
MiddleAgesAssembly *assembly = [[MiddleAgesAssembly assembly] 
    activateWithCollaborators:@[anotherAssembly]];
  • Allow overriding one or more collaborators, eg NetworkProvider with TestNetworkProvider
  • Collaborators expressed as a protocol must be specified manually.

Rationale:

Don't especially want to change the API again, but benefits are:

Drawbacks:

Changes API again. . . Typhoon 3.1 feature?

@jasperblues
Copy link
Member Author

Implemented. Intend to update docs and push as 3.1 - TyphoonAssemblyActivator is deprecated by this. One outstanding feature:

  • When we inject an assembly we currently simply inject TyphoonComponentFactory. Its better to inject the activated assembly as properties of collaborators work correctly here.

Example:

//Inject TyphoonComponentFactory
@property ApplicationAssembly *assembly; 

assembly.modelProvider //Resolves to TyphoonCollaboratingAssemblyProxy

//Inject activated assembly
@property ApplicationAssembly *assembly; 

assembly.modelProvider //Resolves to activated ModelProvider 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant