Run a virtual iPhone on an Apple Silicon Mac.
Swift
Duo: follow guest-side folds in the window four times a second
Jackyc438d7769804
diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneVirtualMachineWindowController.swift b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneVirtualMachineWindowController.swiftindex d2fbb5fc..2e78c8be 100644--- a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneVirtualMachineWindowController.swift+++ b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneVirtualMachineWindowController.swift@@ -192,7 +192,9 @@ class VPhoneVirtualMachineWindowController: NSObject, NSWindowDelegate {guard let self, let window else { return }applyOrientation(orientation ?? .portrait, to: window)}- timers.append(Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { [weak self] _ in+ // A foldable guest also folds by itself (Xcode DeviceHub), and its+ // panel shows sideways in the window until the poll catches up.+ timers.append(Timer.scheduledTimer(withTimeInterval: foldableGuest ? 0.25 : 1, repeats: true) { [weak self] _ inTask { @MainActor in self?.pollOrientation() }})// A Duo guest shows its lit panel itself, so it takes no fold@@ -285,7 +287,8 @@ class VPhoneVirtualMachineWindowController: NSObject, NSWindowDelegate {private var minimumDuoPanelSize: CGSize?private var orientationPollInFlight = false- /// Asks vphoned for the interface orientation once a second. Guests+ /// Asks vphoned for the interface orientation once a second (a foldable+ /// guest four times a second). Guests/// without `display.orientation` stay portrait. A read that overlaps a/// rotation the menu started is dropped: it may predate the turn.private func pollOrientation() {