Skip to content

Instantly share code, notes, and snippets.

@Gernot
Created July 10, 2020 10:27
Show Gist options
  • Save Gernot/51048d64f55c435764276cce2770fe22 to your computer and use it in GitHub Desktop.
Save Gernot/51048d64f55c435764276cce2770fe22 to your computer and use it in GitHub Desktop.
Scrollable Centered Text
import SwiftUI
struct TestView: View {
var body: some View {
ScrollView {
VStack {
Text("Text Before")
ScrollView(.horizontal) {
Text("Scrollable Text")
.border(Color.red)
}
Text("Text After")
}
.frame(maxWidth: .infinity)
.border(Color.green)
}
.frame(width: 300) .border(Color.yellow)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment