Open aehlke opened 8 months ago
Although everything works on iOS, I only have expectations of it being useful on an iPad. I my own usage, I just drop back to navigation to full screen views on an iPhone when I'm using a SplitView on the Mac (using Catalyst). As you say, I don't think there is any precedence for a splitter on iOS, so I am just avoiding it myself to avoid confusing users and cramping the screen. For these reasons, I don't really feel motivated to invest in a more native default for iOS, although if you created one that could be made visible via Splitter+Extensions.swift
, I would love to take a PR on it.
On the Mac, where I'm not using a custom Splitter, I have just been using .splitter { Splitter.line() }
. I wonder if I could something more like Splitter.macOS
that used Divider, so that it automatically gets the right color. Did you find Color.secondary.opacity(colorScheme == .dark ? 0.7 : 0.5)
at some reputable source, or it it just a guess, and do you know if that applies to Dividers? I'd still need to force a default width so that the mechanics of splitting the view works properly.
Altho I'm using a RoundedRectangle for the default splitter, it should be the same as Capsule since the radius is always half the width.
Thanks for your thoughts! I can contribute my experiments a bit later
The opacity is just from eyeballing it, I can measure more exactly
I believe these splitter specs are reasonably close to the iOS system default:
bar color: Color.secondary.opacity(colorScheme == .dark ? 0.7 : 0.5) bar thickness: 5 bar invisible thickness (but also as padding, not just an unclipped ZStack): I'm not sure but the default has some padding typically of approximately 16 or so on either side, could measure this Shape: Capsule rather than RoundedRectangle
On macOS I believe it's simply a Divider() by default, with some tolerance on either side.
Secondly, there's no precedence for split views on iOS. Even iPad splitters are static and unmovable Divider()s. So I recommend (if you wanted to make this view fully native feeling out of the box) having something that behaves more like a sheet/popover on iOS, at least in "compact" mode, such as that it has rounded corners at one end, or perhaps even in fact using the new presentationDetent APIs with the very new API for allowing interaction with an undimmed background. However that's less flexible than this currently so some visual stand-in can work.
It's trivial at least to have a groupbox for a view, and a clear background so that the divider floats between rounded groupbox containers. That would feel native on iOS and not require library changes