Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Open the next Launchpad sheet after the current one has closed

Lakrded81cb25798
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift
index e7f824c0..139a9ce9 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift
@@ -58,13 +58,16 @@ final class VPhoneLaunchpadModel {
panel = nil
}
- /// Called when a panel's sheet has closed.
+ /// Called when a panel's sheet starts to close. On macOS that is the same
+ /// update that cleared `panel`, while the sheet is still attached; setting
+ /// `next` here would swap it into the closing sheet. The next turn of the
+ /// main actor runs after the sheet has gone.
func panelDidDismiss() {
guard let next = queuedPanel else {
return
}
queuedPanel = nil
- panel = next
+ Task { panel = next }
}
// MARK: - Attention