Run a virtual iPhone on an Apple Silicon Mac.
Swift
Move machine details into an inspector and refine Launchpad layout
Lakr233eb86917432c2
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadApp.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadApp.swiftindex 62df770e..dd0b9332 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadApp.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadApp.swift@@ -32,6 +32,11 @@ final class VPhoneLaunchpadAppDelegate: NSObject, NSApplicationDelegate {}func applicationShouldTerminate(_: NSApplication) -> NSApplication.TerminateReply {+ #if DEBUG+ if VPhoneLaunchpadPreview.isActive {+ return .terminateNow+ }+ #endifguard let model, model.machines.hasActiveCreation else {return .terminateNow}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swiftindex bc5eb157..1efb8b5a 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift@@ -53,9 +53,19 @@ final class VPhoneLaunchpadModel {// MARK: - Sections+ #if DEBUG+ /// Snapshot mode keeps setup state in memory, off the real defaults.+ var previewSetupCompleted: Bool?+ #endif+private var setupCompleted: Bool {get {access(keyPath: \.setupCompleted)+ #if DEBUG+ if let previewSetupCompleted {+ return previewSetupCompleted+ }+ #endifreturn UserDefaults.standard.bool(forKey: Self.setupCompletedKey)}set {@@ -111,6 +121,12 @@ final class VPhoneLaunchpadModel {return}isStarted = true+ #if DEBUG+ if VPhoneLaunchpadPreview.isActive {+ await VPhoneLaunchpadPreview.run(self)+ return+ }+ #endifawait host.refresh()await bundles.refresh()await machines.refresh()diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swiftnew file mode 100644index 00000000..5d42829b--- /dev/null+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift@@ -0,0 +1,250 @@+#if DEBUG+ import AppKit+ import SwiftUI++ /// Debug-only snapshot mode. Launched with VPHONE_LAUNCHPAD_SNAPSHOT_DIR+ /// set, the app fills every model with mock data, steps through each page+ /// and sheet in light and dark appearance, draws the window into a PNG+ /// with cacheDisplay (no screen-recording permission needed), and quits.+ enum VPhoneLaunchpadPreview {+ static let outputDirectory = ProcessInfo.processInfo.environment["VPHONE_LAUNCHPAD_SNAPSHOT_DIR"]+ .map { URL(fileURLWithPath: $0, isDirectory: true) }++ static var isActive: Bool {+ outputDirectory != nil+ }++ static let sheetNotification = Notification.Name("VPhoneLaunchpadPreviewSheet")++ // MARK: - Driver++ static func run(_ model: VPhoneLaunchpadModel) async {+ guard let directory = outputDirectory else {+ return+ }+ try? FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)++ let creation = VPhoneLaunchpadCreationPipeline(+ options: creationOptions,+ libraryRoot: model.libraryRoot,+ bundles: model.bundles,+ helper: model.helper,+ library: model.machines,+ )+ creation.applyPreview()+ model.machines.applyPreview(creation: creation)+ for command in commands.dropLast() {+ model.history.finish(model.history.record(command), status: 0)+ }+ _ = model.history.record(commands.last!)++ try? await Task.sleep(for: .seconds(1))+ if let window = mainWindow {+ window.setContentSize(NSSize(width: 980, height: 700))+ window.center()+ }++ for (suffix, appearance) in [("light", NSAppearance.Name.aqua), ("dark", .darkAqua)] {+ NSApp.appearance = NSAppearance(named: appearance)++ model.previewSetupCompleted = false+ model.helper.applyPreview(.notInstalled)+ model.host.applyPreview(blocked: true)+ model.bundles.applyPreview(installing: false)+ model.selection = .hostSetup+ await shot("01-host-setup-first-run", suffix)++ model.helper.applyPreview(.ready("1"))+ model.host.applyPreview(blocked: false)+ model.bundles.applyPreview(installing: true)+ model.selection = .coreBundle+ await shot("02-core-bundle-first-install", suffix)++ model.bundles.applyPreview(installing: false)+ model.previewSetupCompleted = true+ model.selection = .coreBundle+ await shot("03-core-bundle", suffix)++ model.selection = .hostSetup+ await shot("04-host-setup-passed", suffix)++ model.machines.selection = "research-01"+ model.selection = .machines+ await shot("05-machines", suffix)+ if let machine = model.machines.selected {+ await standalone("05b-machine-inspector", suffix, size: NSSize(width: 380, height: 980)) {+ VPhoneLaunchpadMachineInspector(machine: machine) { _ in }+ .environment(model)+ }+ }++ model.machines.selection = "ios27-rc"+ await shot("06-machines-creating", suffix)++ await sheet(.newMachine, "07-new-machine", suffix)+ await sheet(.creation("ios27-rc"), "08-creation-progress", suffix)+ model.machines.selection = "frida-lab"+ if let machine = model.machines.selected {+ await sheet(.settings(machine), "09-machine-settings", suffix)+ }+ await sheet(.clone("frida-lab"), "10-clone", suffix)+ await sheet(.export("frida-lab"), "11-export", suffix)+ }+ NSApp.terminate(nil)+ }++ private static var mainWindow: NSWindow? {+ NSApp.windows.first { $0.isVisible && $0.sheetParent == nil && $0.frame.width > 400 }+ }++ private static func sheet(_ sheet: VPhoneLaunchpadMachinesView.Sheet, _ name: String, _ suffix: String) async {+ NotificationCenter.default.post(name: sheetNotification, object: sheet)+ await shot(name, suffix)+ NotificationCenter.default.post(name: sheetNotification, object: nil)+ try? await Task.sleep(for: .milliseconds(800))+ }++ /// Draws one view in a plain window of its own. Used for the inspector,+ /// whose column cacheDisplay cannot draw inside the main window.+ private static func standalone(+ _ name: String,+ _ suffix: String,+ size: NSSize,+ @ViewBuilder content: () -> some View,+ ) async {+ let window = NSWindow(+ contentRect: NSRect(origin: .zero, size: size),+ styleMask: [.borderless],+ backing: .buffered,+ defer: false,+ )+ window.isReleasedWhenClosed = false+ window.appearance = NSApp.appearance+ window.contentView = NSHostingView(rootView: content())+ window.orderFront(nil)+ try? await Task.sleep(for: .milliseconds(1500))+ if let directory = outputDirectory, let view = window.contentView,+ let bitmap = view.bitmapImageRepForCachingDisplay(in: view.bounds)+ {+ view.cacheDisplay(in: view.bounds, to: bitmap)+ try? bitmap.representation(using: .png, properties: [:])?+ .write(to: directory.appendingPathComponent("\(name)-\(suffix).png"))+ }+ window.close()+ }++ private static func shot(_ name: String, _ suffix: String) async {+ try? await Task.sleep(for: .milliseconds(1500))+ guard let directory = outputDirectory, let window = mainWindow else {+ return+ }+ let target = window.attachedSheet ?? window+ guard let view = target.contentView?.superview ?? target.contentView,+ let bitmap = view.bitmapImageRepForCachingDisplay(in: view.bounds)+ else {+ return+ }+ view.cacheDisplay(in: view.bounds, to: bitmap)+ let url = directory.appendingPathComponent("\(name)-\(suffix).png")+ try? bitmap.representation(using: .png, properties: [:])?.write(to: url)+ }++ // MARK: - Mock data++ static let releases: [VPhoneLaunchpadRelease] = [+ release("2.0.2", "2026-09-25T09:10:00Z", "4be1f0c29a7d6e3b58c0a1d2e9f47b6c3d5a8e1f02b9c7d4e6a3f5b8c1d0e2a9", 16_170_112),+ release("2.0.1", "2026-09-25T03:53:35Z", "98daa4d0b00a6188f87c698e73018d497ca34396f31f95e9e872dd93e488322f", 16_162_877),+ release("2.0.0", "2026-09-24T19:56:17Z", "d57fd532e308dcc6901ec0d58e3a226da5e1a5ec022c2b2b3572894954f167b3", 16_160_944),+ ]++ private static func release(_ version: String, _ date: String, _ sha256: String, _ size: Int64) -> VPhoneLaunchpadRelease {+ VPhoneLaunchpadRelease(+ version: version,+ publishedAt: ISO8601DateFormatter().date(from: date) ?? Date(),+ isPrerelease: true,+ assetName: "VPhone-\(version).zip",+ downloadURL: URL(string: "https://example.invalid/VPhone-\(version).zip")!,+ size: size,+ sha256: sha256,+ )+ }++ static let machines: [VPhoneLaunchpadMachine] = {+ let json = """+ [+ {"name":"research-01","cpuCount":8,"memoryMB":8192,"diskSizeBytes":68719476736,+ "network":{"mode":"nat","macAddress":"5a:94:ef:12:30:01"},+ "restoreInfo":{"ios":{"version":"26.4.2","build":"23E261"},"cloudOS":{"version":"26.4","build":"23E224"},"variant":"jb","device":"iPhone99,11"},+ "udid":"00008140-001A2B3C4D5E6F70"},+ {"name":"ios27-rc","cpuCount":8,"memoryMB":12288,"diskSizeBytes":137438953472,+ "network":{"mode":"nat","macAddress":"5a:94:ef:12:30:02"}},+ {"name":"frida-lab","cpuCount":6,"memoryMB":8192,"diskSizeBytes":68719476736,+ "network":{"mode":"bridged","macAddress":"5a:94:ef:12:30:03","bridgeInterface":"en0"},+ "restoreInfo":{"ios":{"version":"26.6.2","build":"23G90"},"cloudOS":{"version":"26.4","build":"23E224"},"variant":"jb","device":"iPhone99,11"},+ "udid":"00008140-0011223344556677"}+ ]+ """+ return (try? JSONDecoder().decode([VPhoneLaunchpadMachine].self, from: Data(json.utf8))) ?? []+ }()++ static let catalog: VPhoneLaunchpadFirmwareCatalog? = {+ let base = "https://updates.cdn-apple.com/example"+ let json = """+ {"device":"iPhone17,3","pairings":[+ {"ios":{"name":"iOS 26.4.2","url":"\(base)/iPhone17,3_26.4.2_23E261_Restore.ipsw"},"recommendedCloudOS":{"name":"cloudOS 26.4","url":"\(base)/cloudos-26.4"}},+ {"ios":{"name":"iOS 26.5.2","url":"\(base)/iPhone17,3_26.5.2_23F84_Restore.ipsw"},"recommendedCloudOS":{"name":"cloudOS 26.4","url":"\(base)/cloudos-26.4"}},+ {"ios":{"name":"iOS 26.6.2","url":"\(base)/iPhone17,3_26.6.2_23G90_Restore.ipsw"},"recommendedCloudOS":{"name":"cloudOS 26.4","url":"\(base)/cloudos-26.4"}},+ {"ios":{"name":"iOS 27.0 RC","url":"\(base)/iPhone17,3_27.0_24A435_Restore.ipsw"},"recommendedCloudOS":{"name":"cloudOS 26.4","url":"\(base)/cloudos-26.4"}}+ ]}+ """+ return try? JSONDecoder().decode(VPhoneLaunchpadFirmwareCatalog.self, from: Data(json.utf8))+ }()++ static let creationOptions = VPhoneLaunchpadCreationPipeline.Options(+ name: "ios27-rc",+ iphoneSource: "https://updates.cdn-apple.com/example/iPhone17,3_27.0_24A435_Restore.ipsw",+ cloudOSSource: "https://updates.cdn-apple.com/example/cloudos-26.4",+ cpuCount: 8,+ memoryMB: 12288,+ diskSizeGB: 128,+ network: "nat",+ enableFrida: false,+ forceDyldSharedCacheMaxSlide: false,+ keepArtifacts: false,+ )++ static let console = [+ "[vphone] Loaded VM manifest from ~/.vphone/machines/research-01/config.plist",+ "[vphone] Starting guest (PV=3, 8 CPU, 8192 MB)",+ "[vphone] Guest control connected on vsock 1339",+ "[vphoned] ping ok",+ "[vphone] Display 1179x2556 @ 460 ppi",+ ]++ static let creationLog = [+ "$ vphone-cli vm new ios27-rc --cpu 8 --memory 12288 --disk-size 128",+ "created ~/.vphone/machines/ios27-rc",+ "$ vphone-cli fw prepare ios27-rc --iphone-source … --cloudos-source …",+ "[+] Firmware prepared (iPhone + cloudOS merged into bundle).",+ "$ vphone-cli fw patch ios27-rc",+ "[fw patch] applied JB patches",+ "$ vphone-cli vm launch ios27-rc --dfu",+ "$ vphone-cli recovery-probe --ecid 001A2B3C4D5E6F71 --timeout 2 (up to 90 attempts)",+ "device endpoint is reachable",+ "$ vphone-cli restore ios27-rc",+ "restore Sending RestoreRamDisk…",+ "restore Waiting for device to enter restore mode…",+ "restore Verifying restore images…",+ ]++ static let commands = [+ "vphone-cli host preflight --quiet",+ "vphone-cli vm list --json --library-root ~/.vphone/machines",+ "vphone-cli vm new ios27-rc --cpu 8 --memory 12288 --disk-size 128",+ "vphone-cli fw prepare ios27-rc --iphone-source … --cloudos-source …",+ "vphone-cli fw patch ios27-rc",+ "vphone-cli vm launch research-01 --library-root ~/.vphone/machines",+ "vphone-cli restore ios27-rc --library-root ~/.vphone/machines",+ ]+ }+#endifdiff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadStatus.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadStatus.swiftindex 10205ecb..7f1d1195 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadStatus.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadStatus.swift@@ -42,7 +42,8 @@ struct VPhoneLaunchpadStatusIcon: View {// MARK: - Log-/// Command output. The one place the app uses a monospaced face.+/// Command output. The one place the app uses a monospaced face. It sits+/// directly in its form row: no inset, background or border of its own.struct VPhoneLaunchpadLogView: View {let lines: [String]@@ -57,12 +58,9 @@ struct VPhoneLaunchpadLogView: View {}.font(.system(.caption, design: .monospaced)).textSelection(.enabled)- .padding(8).frame(maxWidth: .infinity, alignment: .leading)}- .background(Color(nsColor: .textBackgroundColor))- .clipShape(RoundedRectangle(cornerRadius: 6))- .overlay(RoundedRectangle(cornerRadius: 6).strokeBorder(.separator))+ .scrollContentBackground(.hidden).onChange(of: lines.count) { _, count inproxy.scrollTo(count - 1, anchor: .bottom)}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundle.swift b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundle.swiftindex 1cf3a389..87294300 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundle.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundle.swift@@ -287,3 +287,33 @@ final class VPhoneLaunchpadCoreBundle {loadInstalled()}}++#if DEBUG+ extension VPhoneLaunchpadCoreBundle {+ func applyPreview(installing: Bool) {+ releases = VPhoneLaunchpadPreview.releases+ if installing {+ installed = []+ var progress = InstallProgress(release: releases[0])+ progress.steps = [.download: .running]+ progress.received = 9_400_000+ self.progress = progress+ return+ }+ progress = nil+ installed = VPhoneLaunchpadPreview.releases.dropFirst().map { release in+ var bundle = Installed(receipt: VPhoneLaunchpadBundleReceipt(+ version: release.version,+ sha256: release.sha256,+ installedAt: release.publishedAt.addingTimeInterval(3600),+ cdhashes: [:],+ ))+ bundle.policy = .passed+ bundle.policyDetail = "exception"+ bundle.preflight = .passed+ bundle.preflightDetail = "passed"+ return bundle+ }+ }+ }+#endifdiff --git a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swiftindex b7250469..786d15eb 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift@@ -135,16 +135,13 @@ struct VPhoneLaunchpadCoreBundleView: View {private func installedRow(_ bundle: VPhoneLaunchpadCoreBundle.Installed) -> some View {let isActive = bundle.version == bundles.activeVersion- return HStack(spacing: 12) {+ return HStack(alignment: .firstTextBaseline, spacing: 12) {VStack(alignment: .leading, spacing: 2) {- HStack(spacing: 6) {- Text("VPhone.bundle \(bundle.version)")- if isActive {- Text("Active")- .font(.caption)- .foregroundStyle(.secondary)- }- }+ // The version in use is the one with the green title.+ Text("VPhone.bundle \(bundle.version)")+ .foregroundStyle(isActive ? AnyShapeStyle(.green) : AnyShapeStyle(.primary))+ .accessibilityValue(isActive ? "In use" : "")+ .help(isActive ? "In use" : "")Text("Installed \(bundle.receipt.installedAt.formatted(date: .abbreviated, time: .omitted)) · SHA-256 \(Self.shortDigest(bundle.receipt.sha256))").font(.caption).foregroundStyle(.secondary)@@ -164,10 +161,9 @@ struct VPhoneLaunchpadCoreBundleView: View {}.font(.callout).help(bundle.preflightDetail)- if !isActive {- Button("Use") { Task { await bundles.use(bundle.version) } }- }Menu {+ Button("Use This Version") { Task { await bundles.use(bundle.version) } }+ .disabled(isActive)Button("Run Preflight Again") { Task { await bundles.verify(bundle.version) } }Button("Show in Finder") {NSWorkspace.shared.activateFileViewerSelecting([VPhoneLaunchpadBundleStore.bundle(version: bundle.version)])@@ -195,13 +191,12 @@ struct VPhoneLaunchpadCoreBundleView: View {}private func releaseRow(_ release: VPhoneLaunchpadRelease, prominent: Bool) -> some View {- HStack {+ HStack(alignment: .firstTextBaseline) {VStack(alignment: .leading, spacing: 2) {- HStack(spacing: 6) {+ HStack(alignment: .firstTextBaseline, spacing: 6) {Text("VPhone.bundle \(release.version)")if release.isPrerelease {Text("Pre-release")- .font(.caption).foregroundStyle(.orange)}}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHelperClient.swift b/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHelperClient.swiftindex c1858602..f6b8fffb 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHelperClient.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHelperClient.swift@@ -289,3 +289,11 @@ nonisolated final class VPhoneLaunchpadHelperReceiver: NSObject, VPhoneLaunchpadhandler?(line)}}++#if DEBUG+ extension VPhoneLaunchpadHelperClient {+ func applyPreview(_ state: State) {+ self.state = state+ }+ }+#endifdiff --git a/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHostSetup.swift b/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHostSetup.swiftindex 19775b40..af6c71b1 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHostSetup.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHostSetup.swift@@ -75,7 +75,12 @@ final class VPhoneLaunchpadHostSetup {}var isDeveloperToolAuthorized: Bool {- EPDeveloperTool().authorizationStatus == .authorized+ #if DEBUG+ if VPhoneLaunchpadPreview.isActive {+ return checks.first { $0.kind == .developerTools }?.status == .passed+ }+ #endif+ return EPDeveloperTool().authorizationStatus == .authorized}// MARK: - Checking@@ -246,3 +251,19 @@ final class VPhoneLaunchpadHostSetup {(url.path as NSString).abbreviatingWithTildeInPath}}++#if DEBUG+ extension VPhoneLaunchpadHostSetup {+ func applyPreview(blocked: Bool) {+ update(.appleSilicon, (.passed, "arm64"))+ update(.macOS, (.passed, "27.0"))+ update(.physicalMac, (.passed, "kern.hv_vmm_present = 0"))+ update(.libraryVolume, (.passed, "~/.vphone/machines"))+ update(.developerTools, blocked ? (.pending, "Not requested") : (.passed, "Allowed"))+ update(.helper, blocked ? (.pending, "Not installed") : (.passed, "Version 1"))+ update(.diskSpace, (.warning, "84 GB free, 100 GB recommended"))+ update(.resources, (.passed, "12 cores, 36 GB"))+ update(.network, (.passed, "updates.cdn-apple.com, api.github.com"))+ }+ }+#endifdiff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swiftindex b400ada8..362b7533 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift@@ -421,3 +421,19 @@ final class VPhoneLaunchpadCreationPipeline {return false}}++#if DEBUG+ extension VPhoneLaunchpadCreationPipeline {+ func applyPreview() {+ let finished: [Step: TimeInterval] = [.create: 1, .prepare: 862, .patch: 48, .bootDFU: 6, .waitDFU: 3]+ for (step, duration) in finished {+ statuses[step] = .passed+ durations[step] = duration+ }+ statuses[.restore] = .running+ current = .restore+ isRunning = true+ log = VPhoneLaunchpadPreview.creationLog+ }+ }+#endifdiff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swiftnew file mode 100644index 00000000..035cc11e--- /dev/null+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift@@ -0,0 +1,148 @@+import AppKit+import SwiftUI++// MARK: - State label++/// A machine's run state as the table and the inspector show it.+struct VPhoneLaunchpadMachineStateLabel: View {+ let state: VPhoneLaunchpadMachineLibrary.RunState++ var body: some View {+ let (status, text): (VPhoneLaunchpadStatus, String) = switch state {+ case .running: (.passed, "Running")+ case .stopped: (.pending, "Stopped")+ case let .busy(activity): (.running, activity.prefix(1).uppercased() + activity.dropFirst())+ }+ Label {+ Text(text).lineLimit(1)+ } icon: {+ VPhoneLaunchpadStatusIcon(status: status)+ }+ }+}++// MARK: - Inspector++/// The trailing inspector for the selected machine. Values are split into+/// short rows, since the column is narrow, and long ones truncate in the+/// middle.+struct VPhoneLaunchpadMachineInspector: View {+ let machine: VPhoneLaunchpadMachine+ let onShowProgress: (String) -> Void+ @Environment(VPhoneLaunchpadModel.self) private var model++ private var library: VPhoneLaunchpadMachineLibrary {+ model.machines+ }++ var body: some View {+ Form {+ Section {+ if let creation = library.creations[machine.name] {+ creationSummary(creation)+ }+ LabeledContent("State") {+ VPhoneLaunchpadMachineStateLabel(state: library.state(of: machine.name))+ }+ if let started = library.startedAt[machine.name] {+ LabeledContent("Started", value: started.formatted(date: .omitted, time: .shortened))+ }+ if let variant = machine.restoreInfo?.variant {+ LabeledContent("Variant", value: variant)+ }+ } header: {+ Text(machine.name)+ .font(.headline)+ }++ Section("Firmware") {+ if let info = machine.restoreInfo {+ LabeledContent("iOS", value: "\(info.ios.version) (\(info.ios.build))")+ LabeledContent("cloudOS", value: "\(info.cloudOS.version) (\(info.cloudOS.build))")+ } else {+ Text("Not restored").foregroundStyle(.secondary)+ }+ }++ Section("Hardware") {+ LabeledContent("CPU", value: "\(machine.cpuCount) cores")+ LabeledContent("Memory", value: VPhoneLaunchpadMachinesView.memory(machine.memoryMB))+ LabeledContent("Disk", value: VPhoneLaunchpadMachinesView.disk(machine.diskSizeBytes))+ LabeledContent("Network", value: machine.networkDescription)+ }++ Section("Identity") {+ if let udid = machine.udid {+ value("UDID", udid)+ }+ value(+ "Location",+ VPhoneLaunchpadHostSetup.abbreviated(library.libraryRoot.appendingPathComponent(machine.name)),+ )+ }++ Section("Console") {+ VPhoneLaunchpadLogView(lines: library.consoles[machine.name] ?? [])+ .frame(minHeight: 160)+ }++ Section("Recent Commands") {+ commands+ }+ }+ .formStyle(.grouped)+ .onAppear { library.loadConsoleIfNeeded(machine.name) }+ .onChange(of: machine.name) { _, name in library.loadConsoleIfNeeded(name) }+ }++ private func value(_ title: String, _ value: String) -> some View {+ LabeledContent(title) {+ Text(value)+ .lineLimit(1)+ .truncationMode(.middle)+ .textSelection(.enabled)+ .help(value)+ }+ }++ private func creationSummary(_ creation: VPhoneLaunchpadCreationPipeline) -> some View {+ LabeledContent {+ Button("Show Progress") { onShowProgress(creation.options.name) }+ } label: {+ if creation.isRunning {+ Label { Text("Creating: \(creation.current?.title ?? "")") } icon: { VPhoneLaunchpadStatusIcon(status: .running) }+ } else if creation.isFinished {+ Label { Text("Created") } icon: { VPhoneLaunchpadStatusIcon(status: .passed) }+ } else {+ Label { Text(creation.failure?.message ?? "Creation stopped") } icon: { VPhoneLaunchpadStatusIcon(status: .failed) }+ }+ }+ }++ @ViewBuilder+ private var commands: some View {+ let entries = Array(model.history.entries.suffix(12).reversed())+ if entries.isEmpty {+ Text("Commands Launchpad runs appear here.")+ .foregroundStyle(.secondary)+ }+ ForEach(entries) { entry in+ Label {+ Text(entry.text)+ .font(.system(.callout, design: .monospaced))+ .lineLimit(1)+ .truncationMode(.middle)+ .textSelection(.enabled)+ .help(entry.text)+ } icon: {+ VPhoneLaunchpadStatusIcon(status: entry.status.map { $0 == 0 ? .passed : .failed } ?? .running)+ }+ .contextMenu {+ Button("Copy Command") {+ NSPasteboard.general.clearContents()+ NSPasteboard.general.setString(entry.text, forType: .string)+ }+ }+ }+ }+}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swiftindex ab406c12..8029c45a 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift@@ -308,3 +308,16 @@ final class VPhoneLaunchpadMachineLibrary {}}}++#if DEBUG+ extension VPhoneLaunchpadMachineLibrary {+ func applyPreview(creation: VPhoneLaunchpadCreationPipeline) {+ machines = VPhoneLaunchpadPreview.machines+ externallyRunning = ["research-01"]+ startedAt = ["research-01": Date().addingTimeInterval(-6130)]+ consoles = ["research-01": VPhoneLaunchpadPreview.console]+ creations = ["ios27-rc": creation]+ selection = "research-01"+ }+ }+#endifdiff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swiftindex d4ee2da6..9e674270 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift@@ -25,6 +25,7 @@ struct VPhoneLaunchpadMachinesView: View {@Environment(VPhoneLaunchpadModel.self) private var model@State private var sheet: Sheet?@State private var deletion: String?+ @State private var showsInspector = trueprivate var library: VPhoneLaunchpadMachineLibrary {model.machines@@ -36,21 +37,25 @@ struct VPhoneLaunchpadMachinesView: View {if library.machines.isEmpty {emptyState} else {- VSplitView {- table(selection: $library.selection)- .frame(minHeight: 140, idealHeight: 200)- Group {- if let machine = library.selected {- detail(machine)- } else {- ContentUnavailableView("No Selection", systemImage: "iphone")- }- }- .frame(minHeight: 260)+ table(selection: $library.selection)+ }+ }+ .inspector(isPresented: $showsInspector) {+ Group {+ if let machine = library.selected {+ VPhoneLaunchpadMachineInspector(machine: machine) { name in sheet = .creation(name) }+ } else {+ ContentUnavailableView("No Selection", systemImage: "iphone")}}+ .inspectorColumnWidth(min: 300, ideal: 360, max: 520)}.toolbar { toolbar }+ #if DEBUG+ .onReceive(NotificationCenter.default.publisher(for: VPhoneLaunchpadPreview.sheetNotification)) { note in+ sheet = note.object as? Sheet+ }+ #endif.sheet(item: $sheet) { sheet insheetContent(sheet).environment(model)@@ -122,6 +127,12 @@ struct VPhoneLaunchpadMachinesView: View {Label("New Machine", systemImage: "plus")}.help("Create a machine")+ Button {+ showsInspector.toggle()+ } label: {+ Label("Inspector", systemImage: "sidebar.trailing")+ }+ .help(showsInspector ? "Hide the inspector" : "Show the inspector")}}@@ -159,25 +170,27 @@ struct VPhoneLaunchpadMachinesView: View {private func table(selection: Binding<String?>) -> some View {Table(library.machines, selection: selection) {TableColumn("Name", value: \.name)+ .width(min: 90, ideal: 110)TableColumn("iOS") { machine inText(machine.restoreInfo.map { "\($0.ios.version) (\($0.ios.build))" } ?? "—")}+ .width(min: 110, ideal: 120)TableColumn("State") { machine in- stateLabel(machine.name)+ VPhoneLaunchpadMachineStateLabel(state: library.state(of: machine.name))}- .width(min: 120, ideal: 180)+ .width(min: 150, ideal: 160)TableColumn("CPU") { machine inText("\(machine.cpuCount)").monospacedDigit()}- .width(50)+ .width(40)TableColumn("Memory") { machine inText(Self.memory(machine.memoryMB)).monospacedDigit()}- .width(70)+ .width(64)TableColumn("Disk") { machine inText(Self.disk(machine.diskSizeBytes)).monospacedDigit()}- .width(70)+ .width(64)}.contextMenu(forSelectionType: String.self) { names inmachineActions(library.machines.first { names.contains($0.name) })@@ -188,19 +201,6 @@ struct VPhoneLaunchpadMachinesView: View {}}- private func stateLabel(_ name: String) -> some View {- let (status, text): (VPhoneLaunchpadStatus, String) = switch library.state(of: name) {- case .running: (.passed, "Running")- case .stopped: (.pending, "Stopped")- case let .busy(activity): (.running, activity.prefix(1).uppercased() + activity.dropFirst())- }- return Label {- Text(text).lineLimit(1)- } icon: {- VPhoneLaunchpadStatusIcon(status: status)- }- }-private var emptyState: some View {ContentUnavailableView {Label("No Machines", systemImage: "iphone")@@ -213,94 +213,6 @@ struct VPhoneLaunchpadMachinesView: View {}}- // MARK: - Detail-- private func detail(_ machine: VPhoneLaunchpadMachine) -> some View {- Form {- Section {- if let creation = library.creations[machine.name] {- creationSummary(creation)- }- LabeledContent("State") { stateLabel(machine.name) }- if let started = library.startedAt[machine.name] {- LabeledContent("Started", value: started.formatted(date: .omitted, time: .shortened))- }- LabeledContent("Firmware", value: machine.restoreInfo.map {- "iOS \($0.ios.version) (\($0.ios.build)) on cloudOS \($0.cloudOS.version)"- } ?? "Not restored")- if let variant = machine.restoreInfo?.variant {- LabeledContent("Variant", value: variant)- }- LabeledContent(- "Hardware",- value: "\(machine.cpuCount) cores, \(Self.memory(machine.memoryMB)), \(Self.disk(machine.diskSizeBytes)) disk",- )- LabeledContent("Network", value: machine.networkDescription)- if let udid = machine.udid {- LabeledContent("UDID") { Text(udid).textSelection(.enabled) }- }- LabeledContent(- "Location",- value: VPhoneLaunchpadHostSetup.abbreviated(library.libraryRoot.appendingPathComponent(machine.name)),- )- } header: {- Text(machine.name)- }-- Section("Console") {- VPhoneLaunchpadLogView(lines: library.consoles[machine.name] ?? [])- .frame(minHeight: 160)- }-- Section("Recent Commands") {- commands- }- }- .formStyle(.grouped)- .onAppear { library.loadConsoleIfNeeded(machine.name) }- .onChange(of: machine.name) { _, name in library.loadConsoleIfNeeded(name) }- }-- private func creationSummary(_ creation: VPhoneLaunchpadCreationPipeline) -> some View {- LabeledContent {- Button("Show Progress") { sheet = .creation(creation.options.name) }- } label: {- if creation.isRunning {- Label { Text("Creating: \(creation.current?.title ?? "")") } icon: { VPhoneLaunchpadStatusIcon(status: .running) }- } else if creation.isFinished {- Label { Text("Created") } icon: { VPhoneLaunchpadStatusIcon(status: .passed) }- } else {- Label { Text(creation.failure?.message ?? "Creation stopped") } icon: { VPhoneLaunchpadStatusIcon(status: .failed) }- }- }- }-- @ViewBuilder- private var commands: some View {- let entries = Array(model.history.entries.suffix(12).reversed())- if entries.isEmpty {- Text("Commands Launchpad runs appear here.")- .foregroundStyle(.secondary)- }- ForEach(entries) { entry in- Label {- Text(entry.text)- .font(.system(.callout, design: .monospaced))- .lineLimit(1)- .truncationMode(.middle)- .textSelection(.enabled)- } icon: {- VPhoneLaunchpadStatusIcon(status: entry.status.map { $0 == 0 ? .passed : .failed } ?? .running)- }- .contextMenu {- Button("Copy Command") {- NSPasteboard.general.clearContents()- NSPasteboard.general.setString(entry.text, forType: .string)- }- }- }- }-// MARK: - Sheets@ViewBuilderdiff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swiftindex 715ea93c..b1bbd469 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift@@ -167,6 +167,13 @@ struct VPhoneLaunchpadNewMachineView: View {// MARK: - Actionsprivate func loadCatalog() async {+ #if DEBUG+ if VPhoneLaunchpadPreview.isActive {+ catalog = VPhoneLaunchpadPreview.catalog+ pairing = catalog?.pairings.last?.id+ return+ }+ #endifguard catalog == nil, let commandLine = model.bundles.commandLine() else {return}