Mario Guzman republishes Mac HIG

SwiftUI has a grid view that works.

Tim asked if there was a way to ensure that the Default button is at least the same width as Cancel button in a dialog, with SwiftUI and I said I didn’t know.

But watching this video today, I can now see one way to do it.

I would group those buttons in a VStack or HStack.

WRONG:
Save in English = Enregistrer in French

but nearly the same length.

I decided to test out and adapt the code in the video to make the dialog buttons meet the AHIG that Mario republished.

Using a standard HStack allows the “OK” button to be smaller than the “Cancel” button, which not only looks odd it doesn’t meet the AHIG.

A modified version of the code in the video fixes that by making the button the same or larger than the cancel button. Code wise this solution is not elegant at all. There has to be a better way.