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?
Swift is a robust and intuitive programming language created by Apple for building apps for iOS, Mac, Apple TV, and Apple Watch. It's designed to give developers more freedom than ever. Swift is easy to use and open source, so anyone with an idea can create something incredible.
The powerful programming language that is also easy to learn. Swift is a powerful and intuitive programming language for iOS, iPadOS, macOS, tvOS, and watchOS. Writing Swift code is interactive and fun, the syntax is concise yet expressive, and Swift includes modern features developers love.
Swift is worth learning in 2022. It's one of the most in-demand and popular languages employers and companies seek. This versatile language is simple to understand. Furthermore, it's the only dynamic language with an integrated development environment specifically designed for iOS development.
Swift 5, released in March 2019, introduced a stable binary interface on Apple platforms, allowing the Swift runtime to be incorporated into Apple operating systems. It is source compatible with Swift 4. Swift 5.1 was officially released in September 2019.
The problem is the last argument. Make the last argument CGImageGetBitmapInfo(self.CGImage).rawValue
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With