Skip to content

Typhoon 4.x Migration Notes / Issues #562

@vitorhugomagalhaes

Description

@vitorhugomagalhaes

Hi,

I've tried to use the new 4.0.2 release but there were some API changes that I cannot understand. Some of them cause the app to crash.

Here goes a list of issues:

TyphoonAssemblyActivator was deprecated.

Some of our assemblies are not listed in the plist file and thus, we have the following code to manually activate them.

@interface FactoryAssembly : TyphoonAssembly

@end
@implementation FactoryAssembly

- (id) init {
    self = [super init];
    
    if (self) {
        [self activate];
    }
    
    return self;
}

@end

@implementation FactoryAssembly

- (id) init {
    self = [super init];
    
    if (self) {
        [self activate];
    }
    
    return self;
}

@end

After checking the docs it was not clear how to refactor this. Could you please provide some more insights here ?

Plist activation + Modularizing Assemblies

The order used when declaring the assemblies in the plist file was not relevant until now. However, with this new version it has changed somehow.

@interface SupportStoryboardViewFactoryAssembly  : TyphoonAssembly<SupportStoryboardViewFactoryProtocol>

@property(nonatomic, strong, readonly) ServiceAssembly                          *serviceAssembly;
@property(nonatomic, strong, readonly) CommonStoryboardViewFactoryAssembly      *commonStoryboardFactoryAssembly;

@end

If serviceAssembly is declared after SupportStoryboardViewFactoryAssembly the following code will crash:

- (id<HelpCenterArticleDetailsViewModelProtocol>) helpCenterArticleDetailsViewModel:(NSString *) articleID
{
    return [TyphoonDefinition withClass:[HelpCenterArticleDetailsViewModel class] configuration:^(TyphoonDefinition *definition)
            {
                [definition useInitializer:@selector(initWithSupportService:inesService:supportAssembly:settingsService:articleID:) parameters:^(TyphoonMethod *initializer) {
                    [initializer injectParameterWith:[self->_serviceAssembly supportService]];
                    [initializer injectParameterWith:[self->_serviceAssembly inesService]];
                    [initializer injectParameterWith:self];
                    [initializer injectParameterWith:[self->_serviceAssembly settingsService]];
                    [initializer injectParameterWith:articleID];
                }];
            }];
}

Moving ServiceAssembly before SupportStoryboardViewFactoryAssembly solves the issue. Still, due to circular dependencies I cannot follow this approach.

Any ideas how to handle this ?

Thanks in advance,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions