Why is .applying (transform) unresolved?
Also why there is no imageByApplying
anymore?
let output = filter?.outputImage?.applying(transform)
if (output != nil) {
return UIImage(CIImage: output!)
}
return nil;
}
The unresolved identifier is probably UIImage(CIImage
. In Swift 3 it's UIImage(ciImage
Better optional bind outputImage
.
If the check succeeds the transform (which does not return an optional) will be applied
if let output = filter?.outputImage {
return UIImage(ciImage: output.applying(transform))
}
return nil
or preferable
guard let output = filter?.outputImage else { return nil }
return UIImage(ciImage: output.applying(transform))
applying(_
is the Swift 3 syntax of former imageByApplying