SF Symbols lost color (only black) in iOS 15 widget

Multicolor SF symbols are black in iOS 15 widget. (have a look at the attached pictures 14.5 vs 15.0)

this is how it looks in the code:

       Image(uiImage: UIImage(systemName: getIconName(iconId: iconId))!)         .resizable().scaledToFit()         .frame(width: 20)

Playing around with .renderingMode() doesn't help. Only when I set it to .template and set some color, but I need it to be as it was - multicolor. Is this a bug or a feature ?

You haven't said what you did with .renderingMode(), but you need something like this:

Swift:

		var imageConfig = UIImage.SymbolConfiguration.init(scale: (isCompact ? .medium : .large))
		if #available(iOS 15.0, *){
       imageConfig = imageConfig.applying(UIImage.SymbolConfiguration.init(hierarchicalColor: .tintColor))
       imageConfig = imageConfig.applying(UIImage.SymbolConfiguration.configurationPreferringMulticolor())
    }
    rtnImage = rtnImage.withRenderingMode(.alwaysTemplate)
    rtnImage = rtnImage.withConfiguration(imageConfig)

SwiftUI;

   Image(uiImage: UIImage(systemName: getIconName(iconId: iconId))!)
		if #available(iOS 15.0, *){
      .symbolRenderingMode(.multicolor)
   }
Accepted Answer

this is how I fixed it:

       if #available(iOSApplicationExtension 15.0, *) {
        Image(systemName: getIconName(iconId: iconId))
          .resizable()
          .symbolRenderingMode(.multicolor)
          .scaledToFit()
          .frame(width: 20)
      }
SF Symbols lost color (only black) in iOS 15 widget
 
 
Q