SDWebImageSwiftUI
SDWebImageSwiftUI copied to clipboard
Animated Image with rendering mode template
Officially it is not possible to change the colour of the remote SVG image in AnimatedView with template rendering mode.
workaround:
AnimatedImage(...)
.onViewCreate(perform: { view, _ in
guard let imageView = view as? UIImageView else {
return
}
imageView.tintColor = foregroundColor.uiColor
})
We had to use onViewUpdate instead.
And also use imageView.image = imageView.image?.withRenderingMode(.alwaysTemplate) inside.
I remember that there is one .renderingMode (https://github.com/SDWebImage/SDWebImageSwiftUI/blob/master/SDWebImageSwiftUI/Classes/AnimatedImage.swift#L576) available which do the same thing ?