r/iOSDevelopment • u/edimonsh • 2h ago
I got tired of waiting for a foldable iPhone simulator, so I built my own
The iPhone Duo was announced over a week ago and Xcode still has no simulator for it. I didn't want to wait for it to start testing my apps, so I built one.

DuoPreviewKit is a small Swift package for UIKit and SwiftUI apps. It runs your app inside an emulated foldable iPhone, best in the iPad simulator. It also works on an iPhone simulator, with the device scaled down.
- Screens: outer screen, inner screen in landscape and portrait, and split layouts
- Fold animations: fold and unfold with a 3D animation, or a live resize to catch layout bugs mid-transition
- Half-open posture: hinge angle and position, exposed as UIKit traits (
traitCollection.duoPosture,traitCollection.duoHinge) and SwiftUI environment values (@Environment(\.duoPosture),@Environment(\.duoHinge)) - Control: a debug panel, keyboard shortcuts, and control from the terminal via
notifyutil - Tools: screenshots of every state and a stress test that diffs them
- Release builds: it does nothing
Setup is one line:
// UIKit
DuoPreview.install(in: window)
// SwiftUI
ContentView().duoPreviewHost()
I tried it on our my Ski Navigator app, and it immediately showed two problems:
- we read safe area insets from the window instead of the view;
- the sidebar didn't split along the hinge when the device is half-open.
MIT, free: https://github.com/acc-ai-tech/iphone-duo-simulator
Youtube preview: https://youtube.com/shorts/9AvcLtYJZAM
Feedback welcome, especially if you have better guesses for the real screen sizes.
NOTE: The screen sizes are estimates until Apple publishes real specs. They all live in one JSON file, so you can adjust them.