Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Persist window position per VM using ECID as frame autosave name

Lakrb7448b7dc880
diff --git a/sources/vphone-cli/VPhoneWindowController.swift b/sources/vphone-cli/VPhoneWindowController.swift
index 34c00812..2b3c1ca0 100644
--- a/sources/vphone-cli/VPhoneWindowController.swift
+++ b/sources/vphone-cli/VPhoneWindowController.swift
@@ -40,7 +40,13 @@ class VPhoneWindowController: NSObject, NSToolbarDelegate {
window.title = "VPHONE ⏳"
window.subtitle = ecid ?? ""
window.contentView = vmView
- window.center()
+ if let ecid {
+ if !window.setFrameAutosaveName("vphone-\(ecid)") {
+ window.center()
+ }
+ } else {
+ window.center()
+ }
// Toolbar with unified style for two-line title
let toolbar = NSToolbar(identifier: "vphone-toolbar")