So, I have this function inside a subclass:
func colorAt(x x: Int, y: Int)->UIColor {
assert(0<=x && x<width)
assert(0<=y && y<height)
let uncastedData = CGBitmapContextGetData(context)
let data = UnsafePointer<UInt8>(uncastedData)
let offset = 4 * (y * width + x)
let alpha: UInt8 = data[offset]
let red: UInt8 = data[offset+1]
let green: UInt8 = data[offset+2]
let blue: UInt8 = data[offset+3]
let color = UIColor(red: CGFloat(red)/255.0, green: CGFloat(green)/255.0, blue: CGFloat(blue)/255.0, alpha: CGFloat(alpha)/255.0)
return color
}
But, instead of returning a UIColor, I want to return red, green, blue, and alpha individually (so that I don't have to get rgb values from the UIColor later). Is it possible to have more than one return from the function, and if so, how? By the way, not sure if this matters at all, but I also want to be able to access these returns from outside the subclass later on in my code.
Thanks!