HomeiOS Developmentios - enhance Button hit take a look at faucet dimension...

ios – enhance Button hit take a look at faucet dimension by way of interplay contentShape?


I wish to enhance the faucet goal for my Button with out affecting the structure. The button dimension ought to stay the identical (50pt) however ought to enable tapping outdoors of it (one other 50pt) to set off the button. I perceive the contentShape API ought to have the ability to do that utilizing the interplay sort, nevertheless I can’t get it working when utilized to the Button nor its label. It’s a must to faucet instantly within the label’s body, can’t faucet on the Textual content beneath nor above it. What’s the suitable method to do that?

VStack(spacing: 0) {
    Button {
        print("Tapped")
    } label: {
        Textual content("A")
            .body(width: 50, top: 50)
            .background(Coloration.accentColor.opacity(0.2))
            .clipShape(.circle)
            .contentShape(.interplay, .rect(cornerRadius: 0).inset(by: -50))
    }
    .contentShape(.interplay, .rect(cornerRadius: 0).inset(by: -50))
        
    Textual content("Take a look at")
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments