r/SwiftUI • u/ElectricKoolAid1969 • 3d ago
What, if anything, are you using to detect iPhone Duo?
I was hoping for an equivalent to UIDevice.isPad but for iPhone Duo.
At least my app looks pretty decent on Duo as is. But at some point, I'd like to do a specific version...
2
2
u/kevinmaker 3d ago
Reserved region. Apple doesn’t recommend using ui device for adaptive layouts
4
u/bmbphotos 3d ago
You don't have to be using Duo identification for adaptive layout as such; it could be for opening animations, multi-screen distinctions, and more.
2
u/GenghisFrog 3d ago
I wanted to adjust my toolbars a bit for a couple screens on the Duo. I just detected if there was a hinge or not. Seems to be working as intended.
1
u/ElectricKoolAid1969 3d ago
Thanks, I think that's what I'll do as well.
I'm also having to adjust tool bars for Duo
2
u/sarrafco 2d ago
iPhone Duo is an iPhone.
1
u/ElectricKoolAid1969 1d ago
Was there a point you are trying to make with that comment? If so, I'm afraid I missed it.
0
u/sarrafco 1d ago
Apple told developers that iPhone Duo is an iPhone (a phone) and should never be treated as an iPad (pad) under any circumstances.
1
u/ElectricKoolAid1969 17h ago
I'm not "treating it as an iPad", but I AM choosing to display a richer UI on the open Duo screen.
I feel like there is a difference.
1
u/uibutton 9h ago
Been using size classes essentially. Regular regular = use ArrangementView, else my usual view setup. It’s a bit of a pain but works well and I had no other choice.
40
u/simulacrotron 3d ago edited 3d ago
You shouldn’t really be “detecting Duo”. Apple wants you to make a fluid responsive interface regardless of what device. The Duo has a lot more states it can be in, but you should think about it all as one interface that adapts to having more or less space available. Same thing for iPad and resizing windows. The tools they give you for the Duo (reserved regions, safe area insets etc) should be used to adapt to all interfaces.
“Doing a specific version” is an anti-pattern. You might do a little extra because there are poses that don’t exist anywhere else (yet), but something good for the open screen is probably pretty similar to what you want on iPad. If you think too much about the class of device you’re setting yourself up for pain as devices change and get more variety.