CGColorSpace name profile

665 Views Asked by At
let red = UIColor.red
print(red.cgColor.colorSpace!)

The output is <CGColorSpace 0x60000332d260> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1; extended range).

How can I get the single values like profile the name sRGB IEC61966-2.1 as string?

1

There are 1 best solutions below

1
On

BTW, I think, it solves your problem:

let color = UIColor.red
let value = String(describing: color.cgColor.colorSpace)
let profileName = value.split(separator: ";")[2].trimmingCharacters(in: .whitespacesAndNewlines)
print(profileName)

sRGB IEC61966-2.1