divadretlaw / CustomAlert

🔔 Custom Alert for SwiftUI
MIT License
190 stars 18 forks source link

Button actions not working when running on macOS (Designed for iPad) #29

Closed elprl closed 2 weeks ago

elprl commented 2 weeks ago

This code works on iPad but not on macOS 15.0.1 (24A348) running iPad version.

 var body: some View {
        Form {
            inputRows
        }
        .scrollContentBackground(.hidden)
        .background(BackgroundBlurSUI().ignoresSafeArea())
        .navigationTitle("Custom AI Settings")
        .navigationBarTitleDisplayMode(.inline)
        .analyticsScreen(name: "Custom AI Settings")
        .customAlert(Text("Enter New Host").font(.customTitle3).bold(), isPresented: $viewModel.shouldShowHostDialog) {
            Text(verbatim: "Enter the URL of the Custom AI server (e.g. http://localhost:1234 )")
                .allowsHitTesting(false)
                .padding(.bottom)
            TextField(viewModel.customAIHost, text: $viewModel.newHostText)
                .textFieldStyle(.roundedBorder)
                .tint(colorScheme.logoLightOrange)
                .font(.customBody)
        } actions: {
            MultiButton {
                Button("Cancel", role: .cancel, action: {
                    self.viewModel.onCancelNewHost()
                })
                Button("Save", action: {
                    Log.view.debug("Save new host")
                    self.viewModel.onSaveNewHost()
                })
            }
        }
     }

Button actions aren't firing it seems.

divadretlaw commented 2 weeks ago

Thank for reporting this issue. It actually affected all iOS/iPad Apps running on non-iOS platforms.

Should be fixed with 4.0.2