SDWebImageSwiftUI icon indicating copy to clipboard operation
SDWebImageSwiftUI copied to clipboard

Animated Image with rendering mode template

Open ghost opened this issue 3 years ago • 2 comments

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
})

ghost avatar May 25 '22 04:05 ghost

We had to use onViewUpdate instead. And also use imageView.image = imageView.image?.withRenderingMode(.alwaysTemplate) inside.

alexmorral0 avatar Jun 21 '22 15:06 alexmorral0

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 ?

dreampiggy avatar Jun 22 '22 02:06 dreampiggy