Emojis are not properly rendered in accented widgets on iOS 18

Hello,

When I turn on tinted mode on iOS 18, I noticed that the emojis in the widgets are not rendered properly. The widget in the following screenshot is the template project created by Xcode 16.

Workaround:

Convert to image.

// widgetRenderingMode == .accented
Image(uiImage: "😄".toImage(fontSize: size))
    .resizable()
    .scaledToFit()
    .luminanceToAlpha()

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include your findings and post the FB number here once you do. Bug Reporting: How and Why? has tips on creating your bug report.

Rico

WWDR - DTS - Software Engineer

Thanks, Gong, for sharing this workaround, it was very helpful! It inspired me to create a slightly simpler solution without having to convert the emoji to an image. The key is the .luminanceToAlpha() modifier. Additionally I had to add a black background, otherwise the edge was jagged. But the background is transparent in the end result.

Text("😄")
   .background(Color.black)
   .compositingGroup()
   .luminanceToAlpha()
Emojis are not properly rendered in accented widgets on iOS 18
 
 
Q