I need to implement this Objective-C code in Swift 3.0 (I'm using Xcode 8 Beta 3):
// Note: this code comes from an Obj-C category on UIImage
CGImageRef imageRef = CGImageCreateWithImageInRect(self.CGImage, cropRect);
UIImage *image = [UIImage imageWithCGImage:imageRef scale:self.scale orientation:self.imageOrientation];
I can't find anything in the latest documentation for CGImageCreateWithImageInRect()
.
When I write this code in Xcode8's Swift editor:
Swift has shown me an error as:
So, I changed the line to:
And the second line of your code seems to be directly convertible to Swift:
And the latest documentations of
CGImageCreateWithImageInRect
,CGImageCreateWithImageInRect
Clicking the Swift link, it shows: