3

The release notes for iOS 10 features a section titled Wide Color.

The line that has me confused is this one: If your app relies on UIKit to clamp component values (whether you’re creating a color or asking a color for its component values), you need to change your app’s behavior when you link against iOS 10.

What does it mean to clamp component values?? What does that look like in objective-c or swift and how would I update it to comply with the changes coming in iOS 10?

DranoMax
  • 474
  • 4
  • 18
  • 1
    Have you watched the free `WWDC 2016` video `#712 Working with Wide Color`? This explains the topic, changes to iOS / macOS and discusses the impact on developers as well as offering various development options (including doing nothing). Wide colour is briefly mentioned in a couple of other `WWDC 2016` videos as well. Short answer: you probably do not need to be concerned provided you are using Apple's classes but it depends on what software you are shipping. – Robotic Cat Aug 16 '16 at 19:34

1 Answers1

6

That line makes a bit more sense in context:

In iOS 10, the UIColor class uses the extended sRGB color space and its initializers no longer clamp raw component values to between 0.0 and 1.0. If your app relies on UIKit to clamp component values (whether you’re creating a color or asking a color for its component values), you need to change your app’s behavior when you link against iOS 10.

"Clamp[ing] raw component values to between 0.0 and 1.0" means that when you passed the old API a value below 0.0, it would use 0.0 instead, and when you passed the old API a value above 1.0 it would use 1.0 instead.

UIKit no longer does this. In the new extended-sRGB color space, an RGB triplet like (1.0, 0.0, 0.0) means "as red as sRGB can get", but it's now also possible to create colors like (1.1, 0.0, 0.0) that are even redder.

If in iOS 9 or earlier you were passing values outside the 0.0-1.0 range to UIColor, it'll now accept those values, so you'll now get different colors than you did before. If you were only ever passing values in that range before, then there's no change for you.

As noted in comments, there's a lot more info in the WWDC16 session on Wide Color.

rickster
  • 124,678
  • 26
  • 272
  • 326