Recently, I have done a test task for the iOS developer role. My app took a photos from user library and applied a different filters for them. There was some conditions, but it doesn't matter now.
In method - (void)applyFilterWithName:(NSString *)filterName I had a code, which applied a filters to photo.
// Get full image
NSURL *url = [contentEditingInput fullSizeImageURL];
int orientation = [contentEditingInput fullSizeImageOrientation];
CIImage *inputImage = [CIImage imageWithContentsOfURL:url options:nil];
inputImage = [inputImage imageByApplyingOrientation:orientation];
// Add filter
CIFilter *filter = [CIFilter filterWithName:filterName];
[filter setDefaults];
[filter setValue:inputImage forKey:kCIInputImageKey];
CIImage *outputImage = [filter outputImage];
As a result I was said that my code has permanent reinitialization CIFilter and as a result the architecture and structure of the project suffer.
Can me somebody explain how to make that architecture did not suffer and there was constant re-initialize CIFilter.
And why that is the problem? I created instance CIFilter *filter - and this is a problem as permanent reinitialisation. At the same time I created instance NSURL *url and CIImage *imageoutput - and this is not a permanent reinitalisation.
Can anybody help me to understand this. Thanks a lot.
Aucun commentaire:
Enregistrer un commentaire