// A settings form has a MEASURE, and on a Mac the window is wider than it.//// One app, two hosts: the phone's Settings sheet fills a 390pt screen, and the// same sheet in the Mac's page column gets whatever the person dragged the// window to. A typed form set across 900 points puts its key at one end of the// desk and its value at the other, which is the one thing a columned form// cannot survive — so every Settings page is capped at `SettledForm.width` and// sits at the column's leading edge.//// **The branch is HERE, not in the page.** `ScreenPlatformSweepTests` fails any// file under `Screens/` that says `#if os(macOS)`, because a screen answering// "what does this look like on a Mac" is the first of two designs.// `Platform/` is where the app keeps what the two systems do differently at the// level of an ABILITY — and "a window can be dragged wider than a form should// be read at" is exactly that. The phone's screen cannot, so on iOS this is the// identity.//// `SettingsFormWidthSweepTests` holds every Settings page to it.importSwiftUI/// The measure a settled form is read at.enumSettledForm {/// 480 points — about seventy characters of the typewriter at the sheet's/// own row size, which is the width a two-column key/value form stays/// readable across. Wider and the eye loses the row on its way to the/// value; narrower and a device's own name wraps.staticlet width: CGFloat = 480}extensionView {/// Caps a Settings page at the form's measure and holds it at the leading/// edge, so keys stay in their column and values at that column's end.////// On the phone this changes nothing: the screen is already narrower than/// the measure, and a `maxWidth` there would only re-centre what is already/// full width.publicfunc settingsFormWidth() -> someView { modifier(SettingsFormWidth()) }}/// The modifier itself — the one place the two hosts differ about a form.structSettingsFormWidth: ViewModifier {func body(content: Content) -> someView { #if os(macOS)// Two frames, and both are needed: the inner one is the measure the// form is drawn at, the outer one hands the leftover width back to the// column so the form sits at its leading edge rather than centred in a// window nobody asked to be that wide. content .frame(maxWidth: SettledForm.width, alignment: .leading) .frame(maxWidth: .infinity, alignment: .topLeading) #else content #endif }}