Is it possible to have an assembly to define a base configuration and subclass it to have additional configurations?
I'm trying something like this:
@interface RootAssembly : TyphoonAssembly
- (id)abstractObject;
- (id)object;
@end
@implementation RootAssembly
- (id)abstractObject {
return [TyphoonDefinition withClass:[NSObject class]];
}
- (id)object {
return [TyphoonDefinition withParent:[self abstractObject] class:[NSObject class]];
}
@end
@interface ChildAssembly : RootAssembly @end
@implementation ChildAssembly
- (id)object {
return [TyphoonDefinition withParent:[super abstractObject] class:[NSObject class]];
}
@end
Everything works fine if only one assembly is used. If also a second one is instantiated and activated, the method returning the object is not yet swizzled and tries to build a definition, resulting in an exception:
2015-05-27 18:44:37.542 Typho[17693:8488013] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Only TyphoonDefinition object can be set as parent. But in method '(null)' object of class NSObject set as parent'
see more here: https://gist.github.com/oettam/01ac812c040ed28d913c
Is this actually the way to go?