Created
February 12, 2024 04:15
-
-
Save christianselig/edfc4508dfc20fd5958e535c6c52ee60 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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