Last active
June 8, 2019 16:56
-
-
Save aChase55/954c1751b5e579f77113b61d41b0724d to your computer and use it in GitHub Desktop.
Text Slider
This file contains 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 | |
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