Swift 2 and 3: How to use CGBitmapContextCreate

I have the following code:

let ref:CGContextRef = CGBitmapContextCreate(nil , 200, 130, CGImageGetBitsPerComponent(self.CGImage), 0, CGImageGetColorSpace(self.CGImage), CGImageGetBitmapInfo(self.CGImage)) 

The problem is that I get this error:

The expression is not of type 'NilLieralConvertible'

What should I pass instead of nil for the first argument and why?

+5
source share
1 answer

The problem is the last argument. Make the final argument CGImageGetBitmapInfo(self.CGImage).rawValue .

+12
source

All Articles