Hi there!
I'm trying to create an app which scrolls automatically when my mouse goes to the top of the screen or to the bottom. For example the mouse goes towards the top, it has to scroll to the top and vice versa. So if it possible help me please.
Thanks very much!
I leave you my code:
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View{
HStack {
CardView()
CardView()
CardView()
CardView()
}
.padding()
.foregroundColor(Color(.systemRed))
}
}
struct CardView: View {
@State var isFaceUp = false
var body: some View {
ZStack {
let shape = RoundedRectangle(cornerRadius: 20)
if isFaceUp {
shape.fill().foregroundColor(.white)
shape.stroke(lineWidth: 3)
Text("😀").font(.system(size: 80))
} else {
shape.fill()
}
}
.onTapGesture(perform: {
isFaceUp = !isFaceUp
})
}
}
PlaygroundPage.current.setLiveView(ContentView())