Run a virtual iPhone on an Apple Silicon Mac.
Swift
Window title: show VPHONE+/- for daemon status, subtitle shows ECID
Lakr84af29302913
diff --git a/sources/vphone-cli/VPhoneAppDelegate.swift b/sources/vphone-cli/VPhoneAppDelegate.swiftindex 409ce2b6..8b21159a 100644--- a/sources/vphone-cli/VPhoneAppDelegate.swift+++ b/sources/vphone-cli/VPhoneAppDelegate.swift@@ -118,7 +118,8 @@ class VPhoneAppDelegate: NSObject, NSApplicationDelegate {screenHeight: cli.screenHeight,screenScale: cli.screenScale,keyHelper: keyHelper,- control: control+ control: control,+ ecid: vm.ecidHex)windowController = wcdiff --git a/sources/vphone-cli/VPhoneVirtualMachine.swift b/sources/vphone-cli/VPhoneVirtualMachine.swiftindex cb3da217..5b92e79e 100644--- a/sources/vphone-cli/VPhoneVirtualMachine.swift+++ b/sources/vphone-cli/VPhoneVirtualMachine.swift@@ -6,6 +6,8 @@ import Virtualization@MainActorclass VPhoneVirtualMachine: NSObject, VZVirtualMachineDelegate {let virtualMachine: VZVirtualMachine+ /// ECID hex string resolved from machineIdentifier (e.g. "0x0012345678ABCDEF").+ let ecidHex: String?/// Read handle for VM serial output.private var serialOutputReadHandle: FileHandle?/// Synthetic battery source for runtime charge/connectivity updates.@@ -57,7 +59,8 @@ class VPhoneVirtualMachine: NSObject, VZVirtualMachineDelegate {platform.machineIdentifier = machineIdentifierif let identity = Self.resolveDeviceIdentity(machineIdentifier: machineIdentifier) {- print("[vphone] ECID: 0x\(identity.ecidHex)")+ ecidHex = "0x\(identity.ecidHex)"+ print("[vphone] ECID: \(ecidHex!)")print("[vphone] Predicted UDID: \(identity.udid)")do {let outputURL = try Self.writeUDIDPrediction(@@ -68,6 +71,7 @@ class VPhoneVirtualMachine: NSObject, VZVirtualMachineDelegate {print("[vphone] Warning: failed to write udid-prediction.txt: \(error)")}} else {+ ecidHex = nilprint("[vphone] Warning: failed to resolve ECID from machineIdentifier")}diff --git a/sources/vphone-cli/VPhoneWindowController.swift b/sources/vphone-cli/VPhoneWindowController.swiftindex 470e65e2..30db2d45 100644--- a/sources/vphone-cli/VPhoneWindowController.swift+++ b/sources/vphone-cli/VPhoneWindowController.swift@@ -12,7 +12,7 @@ class VPhoneWindowController: NSObject, NSToolbarDelegate {func showWindow(for vm: VZVirtualMachine, screenWidth: Int, screenHeight: Int, screenScale: Double,- keyHelper: VPhoneKeyHelper, control: VPhoneControl+ keyHelper: VPhoneKeyHelper, control: VPhoneControl, ecid: String?) {self.control = control@@ -36,8 +36,8 @@ class VPhoneWindowController: NSObject, NSToolbarDelegate {window.isReleasedWhenClosed = falsewindow.contentAspectRatio = windowSize- window.title = "vphone"- window.subtitle = "daemon connecting..."+ window.title = "VPHONE-"+ window.subtitle = ecid ?? ""window.contentView = vmViewwindow.center()@@ -57,12 +57,12 @@ class VPhoneWindowController: NSObject, NSToolbarDelegate {window.makeFirstResponder(view)NSApp.activate(ignoringOtherApps: true)- // Poll vphoned status for subtitle+ // Poll vphoned status for title indicatorstatusTimer = Timer.scheduledTimer(withTimeInterval: 2, repeats: true) {[weak self, weak window] _ inTask { @MainActor inguard let self, let window, let control = self.control else { return }- window.subtitle = control.isConnected ? "daemon connected" : "daemon connecting..."+ window.title = control.isConnected ? "VPHONE+" : "VPHONE-"}}}