Compiler is unable to type-check this expression in reasonable time error

I am working on a book iOS app that utilizes Google Firebase. I just restarted this project after 10 months of inactive period and thus had to update many things to comply with my new m1 computer as well as software changes. There was one view called SavedBooks that had previously worked and it essentially cross checked Firestore database to the books available. Users are able to save books they like from another view and that would put a marker on the database which the SavedBooks view checked for. However, this view has been giving the Compiler is unable to type-check this expression in reasonable time error ever since the restart.

I've posted a "Skeleton" of the view that reproduces the error. The nested views were necessary to produce an intended UI. The challenge I faced is the error persists even when trying to break them down to other views and use @Binding to pass Observable data. I can't easily break things up because a lot of the data needs to be fed/retrieved realtime and passed between the views.

Anyhow, I can't imagine the attached code would be so difficult for Xcode to do a type check and produce a view. It compiles happily when using something like Text("Hello") inside the deepest if conditional. The frustrating thing is that when I include anything associated with the identifiable classes book and user (that need to be fetched from Firebase) I get an error - so it's not just the button. And I've also tried newer syntaxes like label for the button so confident it's not because of that.

It is a hard one to replicate because it involves Firebase, but any input is appreciated.

import SwiftUI
import Firebase
import FirebaseFirestore
import SDWebImageSwiftUI
import CoreData
import AVKit
import UIKit
import AVFoundation
import FirebaseFirestoreSwift
import Foundation

import SwiftUI

struct SavedBooks: View {
    @State var user_ID = Auth.auth().currentUser?.uid ?? ""
    @ObservedObject var consumer = getUserInfo()
    @ObservedObject var books = getBooks()
    @State var book_detail : books_Data?
    @State var liked_array = []
    @State var count = 0
    @State var width =
    @State var height =
    @State var multi_Color = true
    @State var rem_Num = 0.0
    @State var rem_Str = ""
    @State var watch_Num = "0.0"
    @State var liked_Str = ""
    var body: some View {
            VStack {
                HStack {
                    ScrollView(.vertical, showsIndicators: false) {
                        //iterate on consumers (will be one since only one user signs in)
                        ForEach(self.consumer.datas) { user in
                            //iterate on available books
                            ForEach(self.books.datas) { books in
                                VStack {
                                    ForEach(user.loved, id: \.self) { item in
                                            //if the current book was liked by the user, do the following
                                            if( == item){
                                                VStack {
                                                    Button(action: {
                                                        self.book_detail = books //
                                                    }) {
                                                        if let url = URL(string: books.largeImg) {
                                                                AnimatedImage(url: url)
                                                                    .frame(width: 60, height: 90)
                                                                        RoundedRectangle(cornerRadius: 8)
                                                                            .stroke(Color(white: 0.4))
                                                                    .shadow(radius: 3)
                            }//ForEach books
                        }//ForEach users (only accessing one user account)
        //onAppear is used to load up to date information from Firebase

These are the assisting Observable objects:

struct books_Data : Identifiable {
    var id: String
    var title: String
    var largeImg: String

class getBooks : ObservableObject{
    @Published var datas = [books_Data]()
    private var db = Firestore.firestore()
    func retrieveData(){
        db.collection("movies").addSnapshotListener{ (querySnapshot, error) in
            guard let mov = querySnapshot?.documents else{
                print("No movies")
            self.datas ={(queryDocumentSnapshot) -> books_Data in
                let data =
                let id = data["id"] as? String ?? ""
                let title = data["title"] as? String ?? ""
                let largeImg = data["largeImg"] as? String ?? ""
                return books_Data(id: id, title: title, largeImg: largeImg)

struct userInfo : Identifiable {
    var id: String
    var firstName: String
    var lastName: String
    var emailAddress: String
    var loved: Array<String>

class getUserInfo : ObservableObject{
    @Published var datas = [userInfo]()
    private var db = Firestore.firestore()
    @State private var userID = Auth.auth().currentUser!.uid
    func retrieveData(){
        db.collection("users").whereField("id", isEqualTo: self.userID).addSnapshotListener{ (querySnapshot, error) in
            guard let mov = querySnapshot?.documents else{
                print("No User")
            self.datas ={(queryDocumentSnapshot) -> userInfo in
                let data =
                let id = data["id"] as? String ?? ""
                let firstName = data["firstName"] as? String ?? ""
                let lastName = data["lastName"] as? String ?? ""
                let emailAddress = data["emailAddress"] as? String ?? ""
                let loved = data["loved"] as? Array<String> ?? []
                return userInfo(id: id, firstName: firstName, lastName: lastName, emailAddress: emailAddress, loved: loved)
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum