Skip to content

Instantly share code, notes, and snippets.

@paulhimes
Last active March 9, 2021 02:03
Show Gist options
  • Save paulhimes/432f92c25cad2fbf84d789a0e0f6a438 to your computer and use it in GitHub Desktop.
Save paulhimes/432f92c25cad2fbf84d789a0e0f6a438 to your computer and use it in GitHub Desktop.
OnLayout Tutorial 02
struct MainView: View {
var body: some View {
ScrollView {
HStack {
Spacer()
Text("ScrollView Content")
.multilineTextAlignment(.center)
.foregroundColor(.white)
.background(Color.blue.brightness(0.2))
Spacer()
}
/// Add a constant padding of 123 points above
/// the stack.
.padding(.top, 123)
}
.background(Color.blue)
.overlay(
TitleBar(),
alignment: .top
)
.edgesIgnoringSafeArea(.all)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment