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

TyphoonAssemblyActivator #253

Closed
jasperblues opened this issue Sep 12, 2014 · 1 comment
Closed

TyphoonAssemblyActivator #253

jasperblues opened this issue Sep 12, 2014 · 1 comment

Comments

@jasperblues
Copy link
Member

Users can still use this class if they wish. However:

Drivers

  • TyphoonComponentFactory is an extra concept that needs to be learned and read in the documentation. This doesn't need to be the case.
  • TyphoonComponentFactory being public API increases cost + overhead in maintaining the docs. Especially as we now have Swift version and ObjC version.
  • Casting between factory and assembly does not work in Swift.

Implementation:

Add the following to Typhoon assembly:

/*
* Returns NO. Facade to the TyphoonComponentFactory method (which returns YES). 
*/
@property(nonatomic, readonly) BOOL isBuilt; 

/**
* Raises 'not built' exception. Facade to the TyphoonComponentFactory method 
*/
- (id) componentForType:(id)classOrProtocol; 

Create the following class:

@interface TyphoonAssemblyActivator

@property(nonatomic, copy, readonly) NSArray *assemblies; 

- (instancetype) initWithAssemblies:(NSArray *)assemblies; 

- (void) build;

@end

The build method will cause the array of non-built assemblies to be replaced with built assemblies.

  • Before using TyphoonAssemblyActivator, TyphoonAssembly returns TyphonDefinitions (recipes to build instnaces).
  • After using TyphoonAssemblyActivator, the assembly returns actual built instances.
  • Everything with TyphoonComponentFactory happens behind the scenes.
  • No issues with casting in Swift.
@jasperblues jasperblues changed the title Remove TyphoonComponentFactory from public API TyphoonAssemblyBuilder Dec 9, 2014
@ghost ghost mentioned this issue Dec 13, 2014
@jasperblues jasperblues changed the title TyphoonAssemblyBuilder TyphoonAssemblyActivator Dec 23, 2014
@jasperblues jasperblues added this to the Typhoon 3.0 milestone Dec 25, 2014
@alexgarbarev
Copy link
Contributor

Reviewed.
👍 Nice work!

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

2 participants