I am using Xcode 6.3.1 and Swift.
When a function with several parameters gets some error in the type of the parameter, it is difficult to understand which argument is incorrect.
For example, CGBitmapContextCreate()this code:
let colorSpace:CGColorSpace = CGColorSpaceCreateDeviceRGB()
let bitmapInfo = CGBitmapInfo(CGImageAlphaInfo.PremultipliedLast.rawValue)
let context = CGBitmapContextCreate(nil, UInt(size.width), UInt(size.height), 8, 0, colorSpace, bitmapInfo)
will result in an error:
MyFile.swift:23:19: Cannot invoke 'CGBitmapContextCreate' with an argument list of type '(nil, UInt, UInt, Int, Int, CGColorSpace, CGBitmapInfo)'
Comparing the document and the argument list, I can find that these are the 2nd and 3rd arguments, which should be Int.
Is there a way to make the compiler smarter about this?
source
share