Supporting iOS 18 in a SwiftUI app designed for iOS 26

4 min read

SwiftUIiOS 26iOS 18

Backmark shipped for iOS 26 only. Lowering the minimum to iOS 18 took one file of fallbacks, a compiler that does most of the finding, and one check it can't do for you.

Backmark 1.0 was designed for iOS 26 and shipped with iOS 26 as its minimum. Liquid Glass on the controls, the new close and confirm buttons in toolbars, symbols that draw themselves on. It looked right, and it locked out every iPhone still on iOS 18.

So for 1.0.1 I lowered the minimum to iOS 18.0. The goal was simple to state: someone on iOS 26 should not be able to tell anything changed, and someone on iOS 18 should get an app that looks like it belongs on their phone.

Let the compiler make the list

The first step takes a second. Change the deployment target to 18.0 and build. Every API that only exists on iOS 26 becomes an error:

'glassEffect(_:in:)' is only available in iOS 26.0 or newer

That list is your work plan. Nothing has to be found by reading code or by tapping through the app hoping to spot something. In Backmark the errors fell into a handful of kinds: Liquid Glass on controls, the .close and .confirm button roles, ToolbarSpacer in the bottom bar, the minimized toolbar search and the Draw On symbol transition.

One file for every difference

The tempting fix is to wrap each error in if #available(iOS 26, *) where it appears. Do that for every error and the version checks end up scattered through every screen, and the next person (usually you, in three months) has no idea what iOS 18 users actually see.

Instead, every iOS 26-only call goes through one file, Compatibility.swift. The screens call a helper, and the helper decides:

extension View {
    @ViewBuilder
    func controlGlass<S: Shape>(_ glass: ControlGlass, in shape: S) -> some View {
        if #available(iOS 26, *) {
            glassEffect(glass == .clear ? .clear : .regular, in: shape)
        } else {
            background(glass == .clear ? AnyShapeStyle(.ultraThinMaterial)
                                       : AnyShapeStyle(.regularMaterial), in: shape)
        }
    }
}

The same pattern works for whole views. iOS 26 has Button(role: .close), which draws the system's own close button. iOS 18 doesn't, so the helper draws an xmark with a proper accessibility label:

struct CloseToolbarButton: View {
    let action: () -> Void

    var body: some View {
        if #available(iOS 26, *) {
            Button(role: .close, action: action)
        } else {
            Button(action: action) {
                Image(systemName: "xmark").font(.body.weight(.semibold))
            }
            .accessibilityLabel("Close")
        }
    }
}

The call sites didn't change shape. A screen that used .glassEffect(.regular, in: Circle()) now says .controlGlass(.regular, in: Circle()), and that is the whole diff on that screen.

A couple of differences were too specific to a single screen to deserve a helper, like the bottom bar on the item page, which spreads its three buttons across the classic toolbar on iOS 18 instead of grouping them in the middle. Those stay as one #available check in that screen, with a comment saying what iOS 18 gets instead.

Fall back to iOS 18, not to a fake iOS 26

For each fallback I asked one question: what would a well made iOS 18 app do here? Not: how close can I get to Liquid Glass without having it.

So glass becomes the system material, the same thin material iOS 18's own camera uses over a photo. The checkmark that draws itself on iOS 26 uses Appear on iOS 18, the closest symbol transition that version has. The close button becomes an xmark, and a confirm button becomes the word Done. A navigation bar over a full-bleed photo gets a thin material on iOS 18, because without iOS 26's glass its buttons would sit straight on the picture and be hard to read.

An imitation of glass on iOS 18 would look like neither version. The system materials look exactly like everything else on that phone.

The check the compiler can't do

SF Symbols are referenced by name, as plain strings. A symbol added in a newer iOS release doesn't cause a build error. On an older system it just isn't there, and the button shows nothing.

So I listed every symbol name the app uses, 42 of them, and checked each one exists on iOS 18. They all did, but this is the one part of the work no tool flags for you.

Then look at every screen

The last step was a temporary iOS 18.6 simulator and a walk through every screen: onboarding, the paywall, the camera, the consent sheet, the examination, the result, the collection, an item, the possibilities sheet and Settings.

If you are about to lower your own minimum version, the order that worked for me was: change the target, let the errors become your list, put every difference behind one helper file, check your symbols by hand, and then look at the app on the oldest system you now support.