Here’s one weird trick Apple DON'T want you to know:

If you present a confirmation dialogue from a swipeAction or contextMenu nothing will happen as the view is removed before the dialogue is presented. Annoying, but it makes sense.

Instead, delegate the confirmation to the environment. Now the Button isn't responsible for the presentation and you're left with a nice clean call site.

Here's my implementation with an example: gist.github.com/phillipcaudell

@phill I guess this is instead of the button toggling some state that drives the presence of the dialog?

Follow

@mattiem right, because if the State is inside the Button it’ll be destroyed when the menu/swipe disappears, taking the dialogue with it.

Sign in to participate in the conversation
The Not So Big Company

The home of The Not So Big Company on Mastodon.