Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: appsquickly/typhoon
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.2.9
Choose a base ref
...
head repository: appsquickly/typhoon
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.3.1
Choose a head ref
  • 14 commits
  • 69 files changed
  • 3 contributors

Commits on Sep 6, 2013

  1. Update podspec.

    Jasper Blues committed Sep 6, 2013

    Verified

    This commit was signed with the committer’s verified signature.
    Julesssss Jules
    Copy the full SHA
    8241edf View commit details

Commits on Sep 7, 2013

  1. Update README.md

    jasperblues committed Sep 7, 2013

    Verified

    This commit was signed with the committer’s verified signature.
    Julesssss Jules
    Copy the full SHA
    294e523 View commit details
  2. Introduce infrastructure components

    Erik Sundin committed Sep 7, 2013

    Verified

    This commit was signed with the committer’s verified signature.
    Julesssss Jules
    Copy the full SHA
    201b25d View commit details

Commits on Sep 8, 2013

  1. Added TyphoonComponentFactoryPostProcessor, deprecated TyphoonCompone…

    …ntFactoryMutator
    Erik Sundin committed Sep 8, 2013
    Copy the full SHA
    1b54d8d View commit details
  2. Added TyphoonComponentFactoryPostProcessor, deprecated TyphoonCompone…

    …ntFactoryMutator
    Erik Sundin committed Sep 8, 2013
    Copy the full SHA
    a1f75cc View commit details
  3. removed definition filtering method

    Erik Sundin committed Sep 8, 2013
    Copy the full SHA
    d671e72 View commit details
  4. removed definition filtering method

    Erik Sundin committed Sep 8, 2013
    Copy the full SHA
    a06d77e View commit details
  5. Merge branch 'infrastructure_components' of https://github.com/eriksu…

    …ndin/Typhoon into infrastructure_components
    
    Conflicts:
    	Source/Factory/TyphoonComponentFactory.m
    	Tests/Pods/Pods.xcodeproj/project.pbxproj
    Erik Sundin committed Sep 8, 2013
    Copy the full SHA
    b5f7dee View commit details
  6. Merge pull request #69 from eriksundin/infrastructure_components

    Infrastructure components
    jasperblues committed Sep 8, 2013
    Copy the full SHA
    ba42adc View commit details
  7. removed deprecated mutator. fixes #70

    Erik Sundin committed Sep 8, 2013
    Copy the full SHA
    1522dfc View commit details
  8. corrected source file headers

    Erik Sundin committed Sep 8, 2013
    Copy the full SHA
    e1bb3b9 View commit details
  9. Build with iOS 6.1 simulator.

    Jasper Blues committed Sep 8, 2013
    Copy the full SHA
    e236cd8 View commit details
  10. Add TyphoonStringUtils

    Jasper Blues committed Sep 8, 2013
    Copy the full SHA
    65bdf76 View commit details
  11. Update podspec.

    Jasper Blues committed Sep 8, 2013
    Copy the full SHA
    9200580 View commit details
Showing with 3,073 additions and 3,317 deletions.
  1. +2 −0 README.md
  2. +7 −4 Source/Component/Initializer/Collection/TyphoonParameterInjectedAsCollection.m
  3. +29 −0 Source/Component/TyphoonDefinition+Infrastructure.h
  4. +32 −0 Source/Component/TyphoonDefinition+Infrastructure.m
  5. +55 −47 Source/Factory/Block/TyphoonAssembly.m
  6. 0 Source/Factory/{Mutator → Config}/Patcher/TyphoonPatchObjectFactory.h
  7. 0 Source/Factory/{Mutator → Config}/Patcher/TyphoonPatchObjectFactory.m
  8. +2 −2 Source/Factory/{Mutator → Config}/Patcher/TyphoonPatcher.h
  9. +22 −12 Source/Factory/{Mutator → Config}/Patcher/TyphoonPatcher.m
  10. +2 −3 Source/Factory/{Mutator → Config}/PropertyConfigurers/TyphoonPropertyPlaceholderConfigurer.h
  11. +4 −9 Source/Factory/{Mutator → Config}/PropertyConfigurers/TyphoonPropertyPlaceholderConfigurer.m
  12. +32 −0 Source/Factory/Config/TyphoonComponentFactoryPostProcessor.h
  13. +14 −5 Source/Factory/TyphoonComponentFactory.h
  14. +48 −37 Source/Factory/TyphoonComponentFactory.m
  15. +1 −0 Source/Factory/Xml/TyphoonRXMLElement+XmlComponentFactory.h
  16. +51 −19 Source/Factory/Xml/TyphoonRXMLElement+XmlComponentFactory.m
  17. +3 −3 Source/Factory/Xml/TyphoonXmlComponentFactory.m
  18. +2 −1 Source/Typhoon.h
  19. +37 −0 Source/Utils/TyphoonStringUtils.h
  20. +76 −0 Source/Utils/TyphoonStringUtils.m
  21. +5 −6 ...Mutator/TyphoonComponentFactoryMutator.h → Tests/Factory/Block/InfrastructureComponentsAssembly.h
  22. +30 −0 Tests/Factory/Block/InfrastructureComponentsAssembly.m
  23. +4 −1 Tests/Factory/Block/TyphoonBlockComponentFactoryTests.m
  24. +1 −1 Tests/Factory/{Mutator → Config}/Patcher/TyphoonPatcherTests.m
  25. +2 −2 Tests/Factory/{Mutator → Config}/PropertyConfigurer/TyphoonPropertyPlaceholderConfigurerTests.m
  26. +19 −0 Tests/Factory/Config/TyphoonComponentFactoryPostProcessorMock.h
  27. +20 −0 Tests/Factory/Config/TyphoonComponentFactoryPostProcessorMock.m
  28. +1 −0 Tests/Factory/Shared/TyphoonSharedComponentFactoryTests.h
  29. +8 −1 Tests/Factory/Shared/TyphoonSharedComponentFactoryTests.m
  30. +33 −5 Tests/Factory/TyphoonComponentFactoryTests.m
  31. +3 −1 Tests/Factory/Xml/TyphoonXmlComponentFactoryTests.m
  32. +3 −3 Tests/Podfile.lock
  33. +0 −1 Tests/Pods/BuildHeaders/Typhoon/TyphoonComponentFactoryMutator.h
  34. +1 −0 Tests/Pods/BuildHeaders/Typhoon/TyphoonComponentFactoryPostProcessor.h
  35. +1 −0 Tests/Pods/BuildHeaders/Typhoon/TyphoonDefinition+Infrastructure.h
  36. +1 −1 Tests/Pods/BuildHeaders/Typhoon/TyphoonPatchObjectFactory.h
  37. +1 −1 Tests/Pods/BuildHeaders/Typhoon/TyphoonPatcher.h
  38. +1 −1 Tests/Pods/BuildHeaders/Typhoon/TyphoonPropertyPlaceholderConfigurer.h
  39. +0 −1 Tests/Pods/Headers/Typhoon/TyphoonComponentFactoryMutator.h
  40. +1 −0 Tests/Pods/Headers/Typhoon/TyphoonComponentFactoryPostProcessor.h
  41. +1 −0 Tests/Pods/Headers/Typhoon/TyphoonDefinition+Infrastructure.h
  42. +1 −1 Tests/Pods/Headers/Typhoon/TyphoonPatchObjectFactory.h
  43. +1 −1 Tests/Pods/Headers/Typhoon/TyphoonPatcher.h
  44. +1 −1 Tests/Pods/Headers/Typhoon/TyphoonPropertyPlaceholderConfigurer.h
  45. +1 −1 Tests/Pods/Local Podspecs/Typhoon.podspec
  46. +3 −3 Tests/Pods/Manifest.lock
  47. +2 −2 Tests/Pods/Pods-iOS Tests (Cocoapods)-environment.h
  48. +2 −2 Tests/Pods/Pods-iOS Tests (Cocoapods)-resources.sh
  49. +2 −2 Tests/Pods/Pods-ios-resources.sh
  50. +2 −2 Tests/Pods/Pods-osx-environment.h
  51. +2 −2 Tests/Pods/Pods-osx-resources.sh
  52. +2,308 −3,013 Tests/Pods/Pods.xcodeproj/project.pbxproj
  53. +1 −1 Tests/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-iOS Tests (Cocoapods)-OCHamcrest.xcscheme
  54. +1 −1 Tests/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-iOS Tests (Cocoapods)-OCMockito.xcscheme
  55. +1 −1 Tests/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-iOS Tests (Cocoapods)-Typhoon.xcscheme
  56. +1 −1 Tests/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-iOS Tests (Cocoapods).xcscheme
  57. +1 −1 Tests/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-ios-OCHamcrest.xcscheme
  58. +1 −1 Tests/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-ios-OCMockito.xcscheme
  59. +1 −1 Tests/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-ios.xcscheme
  60. +1 −1 Tests/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-osx-OCHamcrest.xcscheme
  61. +1 −1 Tests/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-osx-OCMockito.xcscheme
  62. +1 −1 Tests/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-osx-Typhoon.xcscheme
  63. +1 −1 Tests/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-osx.xcscheme
  64. +12 −0 Tests/Resources/InfratructureComponentsAssembly.xml
  65. +69 −41 Tests/Tests.xcodeproj/project.pbxproj
  66. +1 −1 Typhoon.podspec
  67. +90 −66 Typhoon.xcodeproj/project.pbxproj
  68. +3 −1 build-configuration.properties
  69. +7 −0 schema/assembly.xsd
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -133,6 +133,8 @@ ensure that the class is in the required state before and after properties are s

* Flexibility. Supports different approaches of dependency injection for different scenarios - native block-style, auto-wiring macros or Spring-style XML.

* Excellent support for circular dependencies.

* Lean. It has a very low footprint, so is appropriate for CPU and memory constrained devices.


Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
////////////////////////////////////////////////////////////////////////////////
//
// TyphoonParameterInjectedAsCollection.m
// Static Library
// TYPHOON FRAMEWORK
// Copyright 2013, Jasper Blues & Contributors
// All Rights Reserved.
//
// Created by Erik Sundin on 8/31/13.
// Copyright (c) 2013 Jasper Blues. All rights reserved.
// NOTICE: The authors permit you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////

#import "TyphoonParameterInjectedAsCollection.h"

29 changes: 29 additions & 0 deletions Source/Component/TyphoonDefinition+Infrastructure.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
////////////////////////////////////////////////////////////////////////////////
//
// TYPHOON FRAMEWORK
// Copyright 2013, Jasper Blues & Contributors
// All Rights Reserved.
//
// NOTICE: The authors permit you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////

#import "TyphoonDefinition.h"

@class TyphoonPropertyPlaceholderConfigurer;
@protocol TyphoonResource;

/**
Declares short-hand definition factory methods for infrastructure components.
*/
@interface TyphoonDefinition (Infrastructure)

/**
Factory method for a TyphoonPropertyPlaceholderConfigurer.
@param resource The resource to load.
@return a definition.
*/
+ (TyphoonDefinition*)propertyPlaceholderWithResource:(id<TyphoonResource>)resource;

@end
32 changes: 32 additions & 0 deletions Source/Component/TyphoonDefinition+Infrastructure.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
////////////////////////////////////////////////////////////////////////////////
//
// TYPHOON FRAMEWORK
// Copyright 2013, Jasper Blues & Contributors
// All Rights Reserved.
//
// NOTICE: The authors permit you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////


#import "TyphoonDefinition+Infrastructure.h"
#import "TyphoonPropertyPlaceholderConfigurer.h"
#import "TyphoonResource.h"
#import "TyphoonInitializer.h"

@implementation TyphoonDefinition (Infrastructure)

+ (TyphoonDefinition *)propertyPlaceholderWithResource:(id<TyphoonResource>)resource {

TyphoonDefinition *definition = [self withClass:[TyphoonPropertyPlaceholderConfigurer class] initialization:^(TyphoonInitializer *initializer) {

initializer.selector = @selector(configurerWithResource:);
[initializer injectWithObject:resource];

}];
definition.key = [NSString stringWithFormat:@"%@-%@", NSStringFromClass(definition.class), [resource description]];
return definition;
}

@end
102 changes: 55 additions & 47 deletions Source/Factory/Block/TyphoonAssembly.m
Original file line number Diff line number Diff line change
@@ -20,8 +20,8 @@
#import "TyphoonAssemblySelectorAdviser.h"
#import "OCLogTemplate.h"

static NSMutableDictionary *resolveStackForKey;
static NSMutableArray *reservedSelectorsAsStrings;
static NSMutableDictionary* resolveStackForSelector;
static NSMutableArray* reservedSelectorsAsStrings;

@implementation TyphoonAssembly

@@ -42,38 +42,38 @@ + (TyphoonAssembly*)defaultAssembly
+ (void)load
{
[super load];
resolveStackForKey = [[NSMutableDictionary alloc] init];
[self reserveSelectors];
}

+ (void)reserveSelectors;
{
reservedSelectorsAsStrings = [[NSMutableArray alloc] init];
[self markSelectorReserved:@selector(init)];
[self markSelectorReserved:@selector(cachedDefinitionsForMethodName)];
[self markSelectorReservedFromString:@".cxx_destruct"];
[self markSelectorReserved:@selector(defaultAssembly)];
reservedSelectorsAsStrings = [[NSMutableArray alloc] init];

[self markSelectorReserved:@selector(init)];
[self markSelectorReserved:@selector(cachedDefinitionsForMethodName)];
[self markSelectorReservedFromString:@".cxx_destruct"];
[self markSelectorReserved:@selector(defaultAssembly)];
}

+ (void)markSelectorReserved:(SEL)selector
{
[self markSelectorReservedFromString:NSStringFromSelector(selector)];
[self markSelectorReservedFromString:NSStringFromSelector(selector)];
}

+ (void)markSelectorReservedFromString:(NSString *)stringFromSelector
+ (void)markSelectorReservedFromString:(NSString*)stringFromSelector
{
[reservedSelectorsAsStrings addObject:stringFromSelector];
[reservedSelectorsAsStrings addObject:stringFromSelector];
}

#pragma mark - Instance Method Resolution
+ (BOOL)resolveInstanceMethod:(SEL)sel
{
if ([self shouldProvideDynamicImplementationFor:sel]) {
if ([self shouldProvideDynamicImplementationFor:sel])
{
[self provideDynamicImplementationToConstructDefinitionForSEL:sel];
return YES;
}

return [super resolveInstanceMethod:sel];
}

@@ -84,7 +84,7 @@ + (BOOL)shouldProvideDynamicImplementationFor:(SEL)sel;

+ (BOOL)selectorReserved:(SEL)selector
{
return [reservedSelectorsAsStrings containsObject:NSStringFromSelector(selector)];
return [reservedSelectorsAsStrings containsObject:NSStringFromSelector(selector)];
}

+ (void)provideDynamicImplementationToConstructDefinitionForSEL:(SEL)sel;
@@ -95,51 +95,52 @@ + (void)provideDynamicImplementationToConstructDefinitionForSEL:(SEL)sel;

+ (IMP)implementationToConstructDefinitionForSEL:(SEL)selWithAdvicePrefix
{
return imp_implementationWithBlock((__bridge id) objc_unretainedPointer((TyphoonDefinition *)^(id me)
{
NSString *key = [TyphoonAssemblySelectorAdviser keyForAdvisedSEL:selWithAdvicePrefix];
return [self definitionForKey:key me:me];
}));
return imp_implementationWithBlock((__bridge id) objc_unretainedPointer((TyphoonDefinition*) ^(id me)
{
NSString* key = [TyphoonAssemblySelectorAdviser keyForAdvisedSEL:selWithAdvicePrefix];
return [self definitionForKey:key me:me];
}));
}

+ (TyphoonDefinition *)definitionForKey:(NSString *)key me:(id)me
+ (TyphoonDefinition*)definitionForKey:(NSString*)key me:(id)me
{
LogTrace(@"Resolving request for definition for key: %@", key);

TyphoonDefinition *cached = [self cachedDefinitionForKey:key me:me];
TyphoonDefinition* cached = [self cachedDefinitionForKey:key me:me];
if (!cached)
{
LogTrace(@"Definition for key: '%@' is not cached, building...", key);
return [self buildDefinitionForKey:key me:me];
}

LogTrace(@"Using cached definition for key '%@.'", key);
return cached;
}

+ (TyphoonDefinition *)cachedDefinitionForKey:(NSString *)key me:(id)me
+ (TyphoonDefinition*)cachedDefinitionForKey:(NSString*)key me:(id)me
{
return [[me cachedDefinitionsForMethodName] objectForKey:key];
}

+ (TyphoonDefinition *)buildDefinitionForKey:(NSString *)key me:(TyphoonAssembly *)me;
+ (TyphoonDefinition*)buildDefinitionForKey:(NSString*)key me:(TyphoonAssembly*)me;
{
NSMutableArray *resolveStack = [self resolveStackForKey:key];
NSMutableArray* resolveStack = [self resolveStackForKey:key];
[self markCurrentlyResolvingKey:key resolveStack:resolveStack];

if ([self dependencyForKey:key involvedInCircularDependencyInResolveStack:resolveStack]) {

if ([self dependencyForKey:key involvedInCircularDependencyInResolveStack:resolveStack])
{
return [self definitionToTerminateCircularDependencyForKey:key];
}

id cached = [self populateCacheWithDefinitionForKey:key me:me];
[self markKeyResolved:key resolveStack:resolveStack];

LogTrace(@"Did finish building definition for key: '%@'", key);

return cached;
}

+ (BOOL)dependencyForKey:(NSString *)key involvedInCircularDependencyInResolveStack:(NSArray *)resolveStack;
+ (BOOL)dependencyForKey:(NSString*)key involvedInCircularDependencyInResolveStack:(NSArray*)resolveStack;
{
if ([resolveStack count] >= 2)
{
@@ -151,67 +152,74 @@ + (BOOL)dependencyForKey:(NSString *)key involvedInCircularDependencyInResolveSt
return YES;
}
}

return NO;
}

+ (TyphoonDefinition *)definitionToTerminateCircularDependencyForKey:(NSString *)key
+ (TyphoonDefinition*)definitionToTerminateCircularDependencyForKey:(NSString*)key
{
// we return a 'dummy' definition just to terminate the cycle. This dummy definition will be overwritten by the real one, which will be set further up the stack and will overwrite this one in 'cachedDefinitionsForMethodName'.
return [[TyphoonDefinition alloc] initWithClass:[NSString class] key:key];
}

+ (NSMutableArray *)resolveStackForKey:(NSString *)key
+ (NSMutableArray*)resolveStackForKey:(NSString*)key
{
NSMutableArray *resolveStack = [resolveStackForKey objectForKey:key];
if (!resolveStack) {
NSMutableArray* resolveStack = [resolveStackForSelector objectForKey:key];
if (!resolveStack)
{
if (!resolveStackForSelector)
{
resolveStackForSelector = [[NSMutableDictionary alloc] init];
}
resolveStack = [[NSMutableArray alloc] init];
[resolveStackForKey setObject:resolveStack forKey:key];
[resolveStackForSelector setObject:resolveStack forKey:key];
}
return resolveStack;
}

+ (void)markCurrentlyResolvingKey:(NSString *)key resolveStack:(NSMutableArray *)resolveStack
+ (void)markCurrentlyResolvingKey:(NSString*)key resolveStack:(NSMutableArray*)resolveStack
{
[resolveStack addObject:key];
}

+ (TyphoonDefinition *)populateCacheWithDefinitionForKey:(NSString *)key me:(TyphoonAssembly *)me;
+ (TyphoonDefinition*)populateCacheWithDefinitionForKey:(NSString*)key me:(TyphoonAssembly*)me;
{
id d = [self definitionByCallingAssemblyMethodForKey:key me:me];
[self populateCacheWithDefinition:d forKey:key me:me];
return d;
}

+ (id)definitionByCallingAssemblyMethodForKey:(NSString *)key me:(TyphoonAssembly *)me
+ (id)definitionByCallingAssemblyMethodForKey:(NSString*)key me:(TyphoonAssembly*)me
{
SEL sel = [TyphoonAssemblySelectorAdviser advisedSELForKey:key];
id cached = objc_msgSend(me, sel); // the advisedSEL will call through to the original, unwrapped implementation because of the active swizzling.
id cached = objc_msgSend(me,
sel); // the advisedSEL will call through to the original, unwrapped implementation because of the active swizzling.
return cached;
}

+ (void)populateCacheWithDefinition:(TyphoonDefinition *)cached forKey:(NSString *)key me:(id)me
+ (void)populateCacheWithDefinition:(TyphoonDefinition*)cached forKey:(NSString*)key me:(id)me
{
if (cached && [cached isKindOfClass:[TyphoonDefinition class]])
{
TyphoonDefinition* definition = (TyphoonDefinition*) cached;
[self setKey:key onDefinitionIfExistingKeyEmpty:definition];

[[me cachedDefinitionsForMethodName] setObject:definition forKey:key];
}
}

+ (void)setKey:(NSString *)key onDefinitionIfExistingKeyEmpty:(TyphoonDefinition *)definition
+ (void)setKey:(NSString*)key onDefinitionIfExistingKeyEmpty:(TyphoonDefinition*)definition
{
if ([definition.key length] == 0)
{
definition.key = key;
}
}

+ (void)markKeyResolved:(NSString *)key resolveStack:(NSMutableArray *)resolveStack
+ (void)markKeyResolved:(NSString*)key resolveStack:(NSMutableArray*)resolveStack
{
if (resolveStack.count) {
if (resolveStack.count)
{
[resolveStack removeAllObjects];
}
}
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@


#import <Foundation/Foundation.h>
#import "TyphoonComponentFactoryMutator.h"
#import "TyphoonComponentFactoryPostProcessor.h"

typedef id (^ObjectCreationBlock)();

@@ -23,7 +23,7 @@ typedef id (^ObjectCreationBlock)();
*
*
*/
@interface TyphoonPatcher : NSObject <TyphoonComponentFactoryMutator>
@interface TyphoonPatcher : NSObject <TyphoonComponentFactoryPostProcessor>
{
NSMutableDictionary* _patches;
}
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
#import "TyphoonInitializer.h"
#import "OCLogTemplate.h"
#import "TyphoonDefinition+InstanceBuilder.h"

#import "TyphoonComponentFactory.h"

@implementation TyphoonPatcher

@@ -49,7 +49,20 @@ - (void)patchDefinition:(TyphoonDefinition*)definition withObject:(ObjectCreatio
/* ====================================================================================================================================== */
#pragma mark - Protocol Methods

- (NSArray*)newDefinitionsToRegister
- (void)postProcessComponentFactory:(TyphoonComponentFactory *)factory
{
for (TyphoonDefinition *newDefinition in [self newDefinitionsToRegister])
{
[factory register:newDefinition];
}

for (TyphoonDefinition* definition in [factory registry])
{
[self patchDefinitionIfNeeded:definition];
}
}

- (NSArray *)newDefinitionsToRegister
{
NSMutableArray* newDefinitions = [[NSMutableArray alloc] init];
for (NSString* key in [_patches allKeys])
@@ -64,18 +77,15 @@ - (NSArray*)newDefinitionsToRegister
return [newDefinitions copy];
}

- (void)mutateComponentDefinitionsIfRequired:(NSArray*)componentDefinitions
- (void)patchDefinitionIfNeeded:(TyphoonDefinition*)definition
{
for (TyphoonDefinition* definition in componentDefinitions)
id patchObject = [_patches objectForKey:definition.key];
if (patchObject)
{
id patchObject = [_patches objectForKey:definition.key];
if (patchObject)
{
LogDebug(@"Patching component with key %@ with object %@", definition.key, patchObject);
[definition setFactoryReference:[self patchFactoryNameForKey:definition.key]];
[definition setInitializer:[[TyphoonInitializer alloc] initWithSelector:@selector(object)]];
[definition setInjectedProperties:nil];
}
LogDebug(@"Patching component with key %@ with object %@", definition.key, patchObject);
[definition setFactoryReference:[self patchFactoryNameForKey:definition.key]];
[definition setInitializer:[[TyphoonInitializer alloc] initWithSelector:@selector(object)]];
[definition setInjectedProperties:nil];
}
}

Loading