I am trying to have two views in an HStack using SwiftUI. However, I keep getting a gap between the two views. The problem occurs in both portrait and landscape layouts.
my code:
struct ContentView: View {
var body: some View {
GeometryReader { g in
HStack {
GeometryReader { g in
HStack {
VStack {
Text("View One")
}
.frame(width: g.size.width * 0.5, height: g.size.height, alignment: .center)
.background(Color.blue)
VStack {
Text("View Two")
}
.frame(width: g.size.width * 0.5, height: g.size.height, alignment: .center)
.background(Color.red)
}
}
}
}
}
}
HStack(spacing: )
- MalikHStack(spacing: 0)
? EDIT: @Malik you were faster ;-) - Jeroenwidth
) of bothVStack
s slightly smaller? - Jeroen