r/iOSProgramming • u/DocMolle • Sep 20 '26
Discussion ArrangementView is declared in SwiftUICore, not SwiftUI
27.1 shipped Friday. I spent most of two days getting a real app onto the Duo, and because the APIs are days old I ended up checking nearly everything against the .swiftinterface files rather than against anything written about them. Notes, in case they save you a detour.
ArrangementView is declared in SwiftUICore. import SwiftUI re-exports it, so your code compiles either way, but if you grep SwiftUI.swiftinterface to work out what's available you come up empty. Search both modules.
The layout preference goes on the pane, not on the arrangement. On the arrangement it compiles and does nothing at runtime, and leaves you at a 50/50 split. Nothing about the API shape suggests where it belongs, so I sat with that one for a while.
The second pane needs its own minWidth. Half folded, mine dropped to 145 points and the label started stacking one character per line.
The reserved region kinds are .division and .occlusion,.
Vertical compression on iOS defaults to keeping the tab bar, so toolbar items overflow first. If you want it the other way round that's .prefersToolbarItems in SwiftUI, .prefersBarItems in UIKit.
All of it went into an Agent Skill, mostly so my own agent stops guessing at spellings: https://github.com/sven-ericmolzahn/iphone-duo-skill MIT. The names came out of the interface files, the samples get type-checked against whatever SDK you have installed, and there's a script that tells you which of these APIs your Xcode actually ships and in which module. That last one is what I expect to keep running after every beta.
There's an A/B test in the repo too, partly because two days isn't long enough to be confident about anything. Same model, three tasks, with the skill and without: 98% against 53%. One run per cell is barely evidence, and I adjusted the grader after reading the outputs, which is the thing you're specifically not supposed to do. Direction, not measurement.
The run without the skill was the interesting one. It read the interface files on its own and found ArrangementView, and the code it wrote compiled. It also passed a point value where a ratio belongs and never set a minimum on the second pane, so it rebuilt the exact sliver bug the task was about. Finding the names turns out to be the easy half.
All simulator, no hardware. The numbers in the repo (insets per pose, the 40pt hinge band) are marked as such. If you've got the device and measure something different, that's the pull request I actually want.
8
u/Casfaber_ Objective-C / Swift Sep 20 '26
Thanks for your research and skill, I’ll have look next week. Waiting till my next release before any update on Xcode etc.
3
u/JGeek00 Sep 20 '26
On my app I used a condition. If the device is foldable use ArrangementView, if not use the standard NavigationSplitView. Like that the app will behave as always on current devices while also having an UI optimized for the Duo. On the outer screen of the Duo it behaves like a normal iPhone
1
u/linuxgfx Sep 20 '26
Thank you for this, I was thinking about the NavigationSplitView but obviously it is not the correct way to do it.
1
u/luke_hollenback Sep 20 '26
Thanks for this...the layout preference belonging to the pane rather than the arrangement I could see giving us all migraine.
Do you know if widgets get any signal about the reserved regions, or does a home screen widget just get handed a size and no idea whether it's sitting next to a division? I build a widget-first app and I can't tell from the docs whether that's something I'll need to handle or something the system absorbs for me.
0
u/[deleted] Sep 20 '26
[removed] — view removed comment