Xcode 12 & SwiftUI: Cannot preview in this file — Failed to update preview

If your SwiftUIView use ObservableObject as environmentObject, try this:

struct SwiftUIView_Previews: PreviewProvider {
    static var previews: some View {
        SwiftUIView().environmentObject(YourObservableObjectClass())
    }
}

Apparently it was a bug with Firestore, which is most likely the cause: XCode 12 Preview Crashes when adding Firebase SDK Swift UI 2.0. The best solution at this point is to call, pod update which should solve the issue. I verified on Xcode 12, iOS 13+.