'Padding HStack in the top of any screen
I want to put an HStack which contains two Texts in the top of any device screen.
the problem is when I use padding that I have to decide fixed size of padding.
Solution 1:[1]
struct ContentView: View {
var body: some View {
VStack(alignment: .leading) {
HStack(spacing: 10) {
Text("Hello world!")
Text("Hello world!")
}.padding(.top, 100)
Spacer()
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | David |