Replies: 3 comments
-
Hi @fatbobman, sorry I have not seen this behavior before and the alerts case study seems to work fine. Do you have a project you can share that reproduces? |
Beta Was this translation helpful? Give feedback.
-
I can furthermore confirm that the alert case study also works from a pure SwiftPM context. @main
struct PreviewApp: App {
var body: some Scene {
WindowGroup {
MyFeatureView_Previews.previews
}
}
} |
Beta Was this translation helpful? Give feedback.
-
I found the reason why Preview crashed due to pop-up alert. It's not a TCA problem, it seems to be an XCode bug at the moment public struct AlertCrashPreview: PreviewProvider {
public static var previews: some View {
AlertCrashView()
}
}
struct AlertCrashView: View {
@State var show = false
var body: some View {
NavigationStack {
VStack {
Button("show") { show.toggle() }
}
.alert(isPresented: $show) {
Alert(title: Text("abc"))
}
// alert doesn't crash if toolbar is commented out
.toolbar {
ToolbarItem {
Button("Del") {}
}
}
}
}
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I was previewing the Feature's view directly in SPM and everything was working fine until I tried to pop up the Alert and the preview crashed.
However, when I test this by importing the Package in Xcode Project, the preview is perfectly fine.
I'm currently developing under Xcode 14, and this issue is also present in the new 14.1 version.
Since the preview crashes without a hint, there is no way to find out what the problem is.
I wonder if anyone else has encountered a similar problem?
Beta Was this translation helpful? Give feedback.
All reactions