commit dd09dc9da82715d063ddcde1376df52a2b27d7b0
parent c51ae7b20f45f18a53684907c970f8fcdb4f997b
Author: Michael Camilleri <[email protected]>
Date: Wed, 24 Jun 2026 21:23:21 +0900
Remove the unused File and View menus on iPad
The iPad menu bar listed the standard File and View menus even though
Crossmate has no surface behind either, leaving the user two empty
menus.
SwiftUI's Commands can only add or replace menus, so the standard ones
are trimmed through UIKit's menu builder instead. This commit overrides
buildMenu(with:) on AppDelegate, removing the .file and .view menus from
the main system menu while leaving Edit and the puzzle's Entry and Hints
commands intact. The override only acts on the main menu, so contextual
menus are untouched, and AppDelegate now derives from UIResponder so it
sits in the responder chain the builder walks.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Diffstat:
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/Crossmate/CrossmateApp.swift b/Crossmate/CrossmateApp.swift
@@ -95,7 +95,19 @@ struct CrossmateApp: App {
// MARK: - App Delegate
-final class AppDelegate: NSObject, UIApplicationDelegate, @preconcurrency UNUserNotificationCenterDelegate, @unchecked Sendable {
+final class AppDelegate: UIResponder, UIApplicationDelegate, @preconcurrency UNUserNotificationCenterDelegate, @unchecked Sendable {
+ /// Trims the iPad/Mac menu bar — and the hold-⌘ discoverability overlay it
+ /// drives — to the menus Crossmate actually uses. The app has no File or
+ /// View surface, so both standard menus are removed; Edit stays (system
+ /// undo/copy/paste), and the puzzle's Entry/Hints menus come from
+ /// `PuzzleCommands`. Only touch the main system menu, never contextual ones.
+ override func buildMenu(with builder: UIMenuBuilder) {
+ super.buildMenu(with: builder)
+ guard builder.system == .main else { return }
+ builder.remove(menu: .file)
+ builder.remove(menu: .view)
+ }
+
var onRemoteNotification: ((
String,
CKDatabase.Scope?,