Thanks for the reply. I'm not questioning the existence of the two invocation methods. I'm asking why you would want the (IMO) defective behavior of the isPresented version of .sheet. In that one, if the closure for content
tries to pass an object from the invoking view to the sheet for display, it is out of date. For example, you're showing a list, and when the user taps an item, you want to pass that item to a sheet so the user can select something from it. But this doesn't work; the sheet doesn't get the current value of the selected-item variable. There are posts and questions galore online about this problem.
Now the problem with the item:onDismiss:content
version is that you have to nillify the item reference to dismiss the sheet. So how are you supposed to return data from the sheet? I ended up having to change the item from a struct to a class and junking it up with some state variables so I could pass it to the sheet and then store the selections the user made on the sheet. And of course I need a copy of the selectedItem
variable because I have to nillify the one that triggers the sheet.
Am I missing something here, or does the design of this thing stymie the programmer at almost every turn? What I'm doing is, I would bet, an extremely common workflow. Why does it require such cumbersome gymnastics?
And this appears to be another example of the conflict between "prefer structs" and "the single source of truth." Structs are copied all over the place, which thoroughly breaks the single-source paradigm. And you can't fix it here with a binding.