5

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:

Expression does not conform to type 'NilLieralConvertible'

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

1 Answer 1

12

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

Sign up to request clarification or add additional context in comments.

2 Comments

It's because the nature of bitmask types has completely changed in Swift 2.0. And CGBitmapInfo is a bitmask type.
Works for Swift 3 too

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.