Question for folks building cross-platform SwiftUI apps: How do you handle conditional layout optimisations?

You need # ifs for a bunch of platform specific stuff, but for stuff like fonts and padding, what pattern do you use? The Environment seems right but I'm not sure exactly what shape this takes

Follow

@harshil for small tweaks I expose a \.userInterfaceIdiom in the environment.

Scaling elements with \.platformScale (à la Catalyst) is another one I use all the time.

Sign in to participate in the conversation
The Not So Big Company

The home of The Not So Big Company on Mastodon.