-
Notifications
You must be signed in to change notification settings - Fork 268
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
Keypath injection #295
Comments
Hi, |
I mean -(id)httpOperationManager{
return [TyphoonDefinition withClass:[AFHTTPRequestOperationManager class] configuration:^(TyphoonDefinition *definition){
[definition injectProperty:@selector(maxConcurrentOperationCount) atKeypath:@"operationQueue.maxConcurrentOperationCount" with:@(1)];
}];
} In this case AFHTTPRequestOperationManager inside its init method has simple implementation of NSOperationQueue. - (instancetype)initWithBaseURL:(NSURL *)url {
self = [super init];
if (!self) {
return nil;
}
............................................ SOME CODE HERE ............................................
self.operationQueue = [[NSOperationQueue alloc] init];
return self;
} But what to do, if AFHTTPRequestOperationManager has a complex initialization of NSOperationQueue (this is just a guess)? Because AFHTTPRequestOperationManager is a library i am can not control of it part initialization configuration. |
Ah, I see that you mean.
I'll write the code later today, since I'm from mobile now Îòïðàâëåíî ñ iPhone 16.12.2014, â 17:28, Dmitry [email protected] íàïèñàë(à):
|
Try this code: - (id)httpOperationManager
{
return [TyphoonDefinition withClass:[AFHTTPRequestOperationManager class] configuration:^(TyphoonDefinition *definition) {
[definition injectProperty:@selector(operationQueue) with:[self operationQueue]];
}];
}
- (id)operationQueue
{
return [TyphoonDefinition withFactory:[self httpOperationManager] selector:@selector(operationQueue) parameters:nil configuration:^(TyphoonFactoryDefinition *definition) {
[definition injectProperty:@selector(maxConcurrentOperationCount) with:@(1)];
}];
} |
Thanks. |
@sdkdimon works? Can we close? |
Hi, i have a AFHTTPRequestOperationManager that comes from pods dependency. AFHTTPRequestOperationManager has property an instance of NSOperationQueue - operationQueue. How i can inject operationQueue maxConcurrentOperationCount property?
So my solution is:
I am trying this implementation, i know that it is worng, because TyphoonInjectionByFactoryReference has no functionality to inject in it something, it is used vice versa.
The text was updated successfully, but these errors were encountered: