Skip to content

Instantly share code, notes, and snippets.

@aChase55
Last active June 8, 2019 16:56
Show Gist options
  • Save aChase55/954c1751b5e579f77113b61d41b0724d to your computer and use it in GitHub Desktop.
Save aChase55/954c1751b5e579f77113b61d41b0724d to your computer and use it in GitHub Desktop.
Text Slider
import SwiftUI
extension View {
public func offset(_ offset: CGPoint) -> Self.Modified<_OffsetEffect> {
self.offset(x: offset.x, y: offset.y)
}
}
struct ContentView : View {
@State var location: Double = 0
var body: some View {
VStack {
HStack {
Text("Hello World")
.offset(CGPoint(x: CGFloat(location), y: 0))
}
Slider(value: $location, from: -100, through: 100, by: 0.1)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment