Post

Replies

Boosts

Views

Activity

Reply to "Failed to produce a diagnostic for expression; please file a bug report" error.
I am also getting the same issue but have not been able to find a solution online or through GPT. It is being flagged on line 7 in the below code "var body: some View {" Failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project Full code: import SwiftUI struct TermDetailView: View { let term: Term @EnvironmentObject var favouriteTermsData: FavouriteTermsData var body: some View { ScrollView { VStack(alignment: .leading, spacing: 16) { HStack { Text(term.title) .font(.largeTitle) .fontWeight(.bold) Spacer() Button(action: { favouriteTermsData.toggleFavourite(term.id) }) { Image(systemName: favouriteTermsData.isFavourite(term.id) ? "star.fill" : "star") .font(.title2) .foregroundColor(.yellow) } } Text(term.definition) .font(.body) if let example = term.example { VStack(alignment: .leading, spacing: 12) { Text("Example:") .font(.title2) .fontWeight(.bold) Text(example) .font(.body) } } } .padding() .navigationBarTitleDisplayMode(.inline) } } }
Apr ’23