2016-09-07 5 views
1

自動注入マクロを使用してアセンブリを正しく取得することに問題があります。たとえば:台風のプロトコルによる自動注入アセンブリ

@protocol IFormatterProvider <NSObject> 

- (id)statusTextFormatter; 

@end 

@interface MyAssembly : TyphoonAssembly <IFormatterProvider> 
@end 

@implementation MyAssembly 

- (id <IFormatterProvider>)formatterProvider 
{ 
    return [TyphoonDefinition with:self]; // First guess 
} 

- (id)statusTextFormatter 
{ 
    // impl 
} 

@end 

はその後、ビジネスロジックファイルでそれを使用しようとしている:

@interface MyStuff() 

@property (nonatomic, strong) InjectedProtocol(IFormatterProvider)formatterProvider; 

@end 

しかし、アセンブリが得たので、「タイプをsatisifyないコンポーネント定義されたが、」エラーが(ところで、タイプミスがある)きTyphoonInjectionDefinitionとして登録済みNSObject

私は何をしているのですか?

答えて

1

this approachを使用して、工場またはプロバイダとして機能するアセンブリ自体を注入できます。これは明示的な配線です。

私は自動配線がアセンブリプロトコルでは機能しないと思っていますが、興味があれば機能要求を出すかもしれません。

+0

明示的な注射を避けることはできません。 [issue](https://github.com/appsquickly/Typhoon/issues/529)を追加しました – Emil

関連する問題