Posts, a community app by Read.cv

Thread
This post has been deleted
Collin Hemeltjen

2. Remove effect only on touch up, don’t automatically remove it after a time period:

Collin Hemeltjen

3. Move touch off of button to cancel:

Collin Hemeltjen

4. Keep the effect on while the touch is down so the user can change their mind about canceling and move the touch back on the button:

Chase
Replying to @collinh

This one I disagree with. As a user this makes me feel like the button’s action will still be triggered if I lift my finger outside of the button. Instead, I would toggle the visible state of the button as the user’s finger moved in and out of it.

Chase
Replying to @collinh

Is this SwiftUI, UIKit, or web?

Eslam Nahel
Replying to @cdoncarroll @collinh

I would love to see how this is done in SwiftUI

Collin Hemeltjen
Replying to @esnahel @cdoncarroll

Well, I got curious as well. So here you go! I have to say it’s been a while since I worked in SwiftUI and I worked on it for maybe 2 hours, so the code could probably be better. But it seems to work pretty good. github.com/CollinHemeltje…

Eslam Nahel
Replying to @collinh @cdoncarroll

This is way better than using the pressed value for the button. Does it bounce even for small touches? Sometimes with button you kind need to “long touch” for it to bounce

Collin Hemeltjen
Replying to @esnahel @cdoncarroll

Animations here are set to 0.1s, so maybe if your tap is quicker than that the button won’t completely bounce. But it seems to react well to my short touches