Fix rendering of buttons in Mac Catalyst mode when optimized for Mac. #5372
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Various buttons were not rendering correctly on Mac Catalyst - Optimized for Mac builds.
Description
.borderless
button style that will apply by default to all buttons on Mac Catalyst, unless they are overridden in a certain view.Without this button style, buttons on Catalyst builds will take on the macOS push-button style by default, which breaks lots of our rendering. Some of our buttons in paywalls didn't have this issue because they explicitly set button styles, but most did not.
I know this fixes at least
PackageComponentView
,TabControlButtonComponentView
,AsyncButton
and probably others.Since SwiftUI buttons with the default style will adapt to their environment (for example, in
List
becoming rows with disclosure indicators), it is possible there could be places where we could be relying on that behavior, and this button style override is not what we want. If we encounter those locations, I think we should explicitly set the button style back to.automatic
in those locations. Our paywall validation and component tests should quickly highlight any locations like that.We should merge #5371 and run the paywall validation screenshot tests before we merge this PR, so that we can verify the diffs for all the paywall templates before making this change.
Last, I considered just applying this button style without limiting it to Mac Catalyst. I'm not sure it's obvious whether it should be limited to Mac Catalyst, or we should just broadly apply this behavior. But I think leaving it as-is on iOS will let us automatically adopt any changes that Apple introduces to standard button behavior, so I think it's the right call to limit this to Mac Catalyst (and possibly native Mac once I get to implementing that).
Some before/after screenshots
Note: the faded look of the before screenshots is an unrelated issue.
Before


After

