I have a heart image/system image that I want to appear by changing the opacity when you tap it two times, but I cannot figure out how to.
import SwiftUI
import PlaygroundSupport
struct ContentView: View{
var body: some View{
Image("apple")
.resizable()
.scaledToFill()
.clipShape(Circle())
.frame(width:200,height:200)
.overlay(
Image(systemName: "heart.fill")
.font(.system(size:50))
.foregroundColor(.red)
.opacity(0)
.onTapGesture(count:2){
}
)
}
}
I expected by tapping on the image two times:
Image(systemName: "heart.fill")
.font(.system(size:50))
.foregroundColor(.red)
.opacity(0)
.onTapGesture(count:2){
opacity(2)
}
it will show the heart, by I cannot change anything