Skip to content

Instantly share code, notes, and snippets.

@christianselig
Created February 12, 2024 04:15
import SwiftUI
struct ContentView: View {
@State var x: CGFloat = -1.0
var body: some View {
VStack(spacing: 50.0) {
Text("\(Int(x))")
RoundedRectangle(cornerRadius: 20.0)
.foregroundStyle(Color.pink)
.frame(width: 200.0, height: 40.0)
.gesture(DragGesture()
.onChanged { value in
x = value.location.x
}
)
.contentShape(.hoverEffect, Rectangle())
.hoverEffect()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment