How to remove spacing between a Text and a labeless Stepper in SwiftUI?

Viewed 274

I have the following code:

VStack {
    HStack {
        Text("Hello World")                 
    }
    Stepper("", value: $test, in: 0...2)   
}

There is substantial space between the Text and the Stepper. How do I get rid of this spacing?

1 Answers

You can set VStack spacing:

VStack(spacing: 0) {
    HStack {
        Text("Hello World")                 
    }
    Stepper("", value: $test, in: 0...2)   
}
Related