Funkybit found a workaround for this issue https://stackoverflow.com/a/79794250/2035054
Image(..)
.widgetAccentedRenderingMode(.desaturated)
.overlay {
Link(destination: linkUrl) {
Rectangle()
.fill(.clear)
}
}
And based on this idea:
struct AccentedLink<Content: View>: View {
let destination: URL
var content: Content
var body: some View {
content.overlay {
Link(destination: destination) {
Rectangle()
.fill(.clear)
}
}
}
init(destination: URL, @ViewBuilder content: () -> Content) {
self.destination = destination
self.content = content()
}
}
And then instead of Link we can use AccentedLink:
AccentedLink(destination: URL(string: "myapp://image")!) {
Image(uiImage: image)
.resizable()
.widgetAccentedRenderingMode(.accentedDesaturated)
.scaledToFill()
.clipped()
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: