ios – SwiftUI Button contact space is irregular


I created SwiftUI Button and its contact space is barely unusual. The contact space extends the label of the button.

That is my code.

struct TestView: View {
    var physique: some View {
        HStack(spacing: 0) {
            Spacer()
        
            Button {
                print("aaaaaa")
            } label: {
                HStack(spacing: 0) {
                    Spacer()
                }
                .body(width: 50.0, peak: 50.0)
                .background(Shade.yellow)
            }
        
            Spacer()
        }
        .body(peak: 50.0)
        .background(Shade.purple)
    }
}

And I am going to connect the end in simulator.

The button space is full of yellow colour. However I might click on the button outdoors of yellow colour.

The identical factor occurs in actual machine too.

How is that this attainable?

Touch area

See also  ios - Eradicating preliminary house from ScrollView in swift UI

Leave a Reply