Brighton Madire Brighton Madire - 2 months ago 18
Swift Question

I want to translate this line to the Swift 3 current syntax code but seems there are some problems

CGContextDrawImage(imageContext, CGRect(origin: CGPointZero, size: image.size), cgImage)


When I change the code to this

CGContext.draw(imageContext as! CGImage, in: CGRect(origin: CGPointZero, size: image.size), byTiling: cgImage)


This error is showing


Cannot convert value of type
CGImage
to expected type
Bool


Answer

Try this:

 imageContext.draw(cgImage, in: CGRect(origin: CGPoint.zero, size: image.size))
Comments