watchOS 9.2 breaks the complicationForeground() modifier

I found that watchOS 9.2 seems to break the complicationForeground() modifier. In previous systems, a View modified by complicationForeground() was rendered white, while an unmodified View was rendered with the watch face tint color. This is the correct behavior.

However, in watchOS 9.2, this behavior has been reversed. The View modified by complicationForeground() renders the tint color, and the opposite is white‽ This causes third-party complications to look very inconsistent on tinted watch faces.

Of course, this issue belongs to ClockKit, and I'm not sure if there are similar issues in the new WidgetKit.

Will this issue be fixed please?

Answered by Gong in 740432022
@ViewBuilder
func complicationLayer(_ layer: Compatibility.ComplicationLayer) -> some View {
    if #available(watchOS 9.2, *) {
        switch layer {
        case .foreground:
            self
        case .background:
            self.complicationForeground()
        }
    } else {
        switch layer {
        case .foreground:
            self.complicationForeground()
        case .background:
            self
        }
    }
}

It's ugly but it works. I don't want Apple to reverse its semantics again, even if it's wrong. So be it.

This issue can only be reproduced on the physical watch with watchOS 9.2 at this time. There is currently no simulator available for watchOS 9.2 in Xcode 14.2. Also, It is worth mentioning that the SwiftUI Preview also does not correctly render the replicationForeground() effect. But this should be another bug.

This is the fix. :-) This release note should have been in one of the 9.2 seeds as follows: "Fixed SwiftUI complication colors being reversed." The intention is for the complicationForeground() modifier to match the widgetAccentable modifier.

You can, of course, file Feedback with your reasoning. :-)

Accepted Answer
@ViewBuilder
func complicationLayer(_ layer: Compatibility.ComplicationLayer) -> some View {
    if #available(watchOS 9.2, *) {
        switch layer {
        case .foreground:
            self
        case .background:
            self.complicationForeground()
        }
    } else {
        switch layer {
        case .foreground:
            self.complicationForeground()
        case .background:
            self
        }
    }
}

It's ugly but it works. I don't want Apple to reverse its semantics again, even if it's wrong. So be it.

watchOS 9.2 breaks the complicationForeground() modifier
 
 
Q