I found the issues adding .alert(isPresented: $showAlert) { Alert(
causes the app to crash when running on Mac Emulator for iPad
everything worked fine until I copied that piece of code over from my project.
struct ContentView: View {
var body: some View {
NavigationStack(path: $path) {
ZStack(alignment: .bottom) {
HStack {
TabView(
selection: $currentTab.onUpdate {}
) {
FriendsView()
.tabItem { Label("Follow", systemImage: "person.3.fill") }
.tag(TabPages.FriendTab)
.buttonStyle(.plain)
}
}
VStack {
Spacer().frame(minHeight: UIScreen.main.bounds.size.height * 0.70)
Text("Test")
Spacer().frame(minHeight: UIScreen.main.bounds.size.height * 0.15)
}
}
}
.toolbar(.hidden)
//
// The Alert Will cause a crash on Mac emulator
//
.alert(isPresented: $showAlert) {
Alert(
title: Text("Problem"),
message: Text(badMessage),
dismissButton: .default(Text("Dismiss"), action: {
fatalError("An error occurred. Exiting the app.")
})
)
}