Swiftui 在HStack容器中连接两个文本视图?

Swiftui 在HStack容器中连接两个文本视图?,swiftui,hstack,Swiftui,Hstack,我想知道是否有人能为我指出正确的方向,让两个文本项在不留下空白的情况下并排放置(见下图)。有很多间距,边界和路线,但在玩了30分钟后,我似乎没有任何接近 我使用的代码如下: struct TestView: View { var body: some View { VStack { HStack() { Text("SHOT").background(Color.red) Text("

我想知道是否有人能为我指出正确的方向,让两个文本项在不留下空白的情况下并排放置(见下图)。有很多间距,边界和路线,但在玩了30分钟后,我似乎没有任何接近

我使用的代码如下:

struct TestView: View {
    var body: some View {
        VStack {
            HStack() {
                Text("SHOT").background(Color.red)
                Text("GUN").background(Color.blue)
            }
            Text("SHOTGUN").background(Color.green)
        }
    }
}
试一试


将间距设置为零非常感谢,先生,太好了。
struct ContentView: View {
    var body: some View {
        VStack {
            HStack(spacing: 0) {
                Text("SHOT").background(Color.red)
                Text("GUN").background(Color.blue)
            }
            Text("SHOTGUN").background(Color.green)
        }
    }
}