Replace the add destination popover with a sheet.

Under catalyst on the mac, the popover was leading to crashes.  After a few rounds with an LLM, it seems this maybe a known problem with popovers under catalyst triggered from toolbar buttons.  The suggestion was to use a sheet so I made that change.

Also, when going into edit mode on the mac, the edit button disappeared entirely from the toolbar.  On the iPhone and iPad, the edit button became a checkmark so that you could exit edit mode.  On the mac, nothing was there but if I clicked where the button was, it did exit edit mode.  Again, the LLM came to the rescue and said this is a known problem with catalyst and suggested using custom code to handle the edit button.  That worked.

The LLM also suggested trying to build a native Mac swiftui app instead of using catalyst.  Catalyst does seem to be buggy but it looks like some of the thirdparty code components I pulled in do not build as a native Mac swiftui app.  So, putting up with the limitations of catalyst for now.
This commit is contained in:
Jeremy Rand
2026-02-13 21:37:20 -05:00
parent bdf7a85895
commit e3c6ce657a
6 changed files with 45 additions and 55 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -258,7 +258,6 @@
isa = PBXNativeTarget;
buildConfigurationList = 9D51561426A1EF7C0075EBC7 /* Build configuration list for PBXNativeTarget "ListenerGS" */;
buildPhases = (
9D51562B26A20CE10075EBC7 /* ShellScript */,
9D5155EB26A1EF7B0075EBC7 /* Sources */,
9D5155EC26A1EF7B0075EBC7 /* Frameworks */,
9D5155ED26A1EF7B0075EBC7 /* Resources */,
@@ -314,8 +313,9 @@
9D5155E726A1EF7B0075EBC7 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1320;
LastUpgradeCheck = 1240;
LastUpgradeCheck = 2620;
TargetAttributes = {
9D5155EE26A1EF7B0075EBC7 = {
CreatedOnToolsVersion = 12.4;
@@ -380,26 +380,6 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
9D51562B26A20CE10075EBC7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
shellScript = "#!/bin/bash\nbN=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbN=$(expr $bN + 1)\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $bN\" \"$INFOPLIST_FILE\"\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
9D5155EB26A1EF7B0075EBC7 /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -503,8 +483,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = VD9FGCW36C;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
@@ -524,6 +506,7 @@
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
@@ -564,8 +547,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = VD9FGCW36C;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -578,6 +563,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
@@ -593,18 +579,24 @@
CODE_SIGN_ENTITLEMENTS = ListenerGS/ListenerGS.entitlements;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"ListenerGS/Preview Content\"";
DEVELOPMENT_TEAM = VD9FGCW36C;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES;
ENABLE_PREVIEWS = YES;
ENABLE_RESOURCE_ACCESS_AUDIO_INPUT = YES;
INFOPLIST_FILE = ListenerGS/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.0.3;
PRODUCT_BUNDLE_IDENTIFIER = com.halcyontouch.ListenerGS;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_OBJC_BRIDGING_HEADER = "ListenerGS/SwiftSocket/ListenerGS-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
@@ -621,18 +613,24 @@
CODE_SIGN_ENTITLEMENTS = ListenerGS/ListenerGS.entitlements;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"ListenerGS/Preview Content\"";
DEVELOPMENT_TEAM = VD9FGCW36C;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES;
ENABLE_PREVIEWS = YES;
ENABLE_RESOURCE_ACCESS_AUDIO_INPUT = YES;
INFOPLIST_FILE = ListenerGS/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.0.3;
PRODUCT_BUNDLE_IDENTIFIER = com.halcyontouch.ListenerGS;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_OBJC_BRIDGING_HEADER = "ListenerGS/SwiftSocket/ListenerGS-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -642,11 +640,9 @@
9D51561826A1EF7C0075EBC7 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = VD9FGCW36C;
INFOPLIST_FILE = ListenerGSTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
@@ -665,11 +661,9 @@
9D51561926A1EF7C0075EBC7 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = VD9FGCW36C;
INFOPLIST_FILE = ListenerGSTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
@@ -688,9 +682,7 @@
9D51561B26A1EF7C0075EBC7 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = VD9FGCW36C;
INFOPLIST_FILE = ListenerGSUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -708,9 +700,7 @@
9D51561C26A1EF7C0075EBC7 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = VD9FGCW36C;
INFOPLIST_FILE = ListenerGSUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",

View File

@@ -7,9 +7,9 @@
import SwiftUI
struct PopOverView : View {
struct SheetView : View {
@State private var destination = ""
@Binding var showPopover: Bool
@Binding var showSheet: Bool
var destinations : GSDestinations
var body: some View {
@@ -18,17 +18,17 @@ struct PopOverView : View {
.font(.title2)
TextField("New destination", text: self.$destination) { isEditing in
} onCommit: {
self.showPopover = false
self.showSheet = false
onAdd()
}
.padding()
HStack {
Button("Cancel") {
self.showPopover = false
self.showSheet = false
}
.padding()
Button("Add") {
self.showPopover = false
self.showSheet = false
onAdd()
}
.padding()
@@ -51,7 +51,7 @@ struct PopOverView : View {
struct DestinationsView: View {
@State private var editMode = EditMode.inactive
@State private var showPopover = false
@State private var showSheet = false
@State private var newDestination = ""
@StateObject private var destinations = GSDestinations()
@@ -68,7 +68,9 @@ struct DestinationsView: View {
}
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
EditButton()
Button(action: toggleEdit) {
Text(editMode == .active ? "Done" : "Edit")
}
}
ToolbarItem(placement: .navigationBarTrailing) {
addButton
@@ -82,10 +84,9 @@ struct DestinationsView: View {
switch editMode {
case .inactive:
return AnyView(Button(action: showAdd) { Image(systemName: "plus") }
.popover(
isPresented: self.$showPopover,
arrowEdge: .bottom
) { PopOverView(showPopover: self.$showPopover, destinations: destinations) } )
.sheet(isPresented: self.$showSheet) {
SheetView(showSheet: self.$showSheet, destinations: destinations)
})
default:
return AnyView(EmptyView())
}
@@ -99,8 +100,12 @@ struct DestinationsView: View {
destinations.onMove(source: source, destination: destination)
}
func toggleEdit() {
editMode = (editMode == .active ? .inactive : .active)
}
func showAdd() {
self.showPopover = true;
self.showSheet = true;
}
}
@@ -109,3 +114,4 @@ struct DestinationsView_Previews: PreviewProvider {
DestinationsView()
}
}

View File

@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0.1</string>
<string>1.0.3</string>
<key>CFBundleVersion</key>
<string>807</string>
<string>837</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSRequiresIPhoneOS</key>

View File

@@ -6,11 +6,5 @@
<array/>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>