Post

Replies

Boosts

Views

Activity

Reply to The compiler is unable to type-check this expression in reasonable time in Xcode 12 with SwiftUI
@OOer, So I've done more troubleshooting, the missing { on line 30 is there in my version, must've accidentally deleted it. I think I've narrowed the issue down to the AddTask() view used in line 65 (thank you @thafner). What I'm trying to do is create a Core Data relationship which I've set up in my data model and now want to expose to users so that they can add tasks to an overarching project. The AddTask view works fine until I attempt to even display current tasks in a list, I haven't begun making those changes to the data store because listing them doesn't seem to work and still throws the The compiler is unable to type-check... error in the same place. I've included the contents of AddTask below: public struct AddTask: View {     static let DefaultTaskDescription = "Something productive"     static let DefaultDueDate = Date()     @State var taskDescription: String = ""     @State var dueDate: Date = Date()     let onComplete: (String, Date) -> Void     @State private var selectedProject: Project = Project()     @FetchRequest(       entity: Project.entity(),       sortDescriptors: [         NSSortDescriptor(keyPath: \Project.projectTitle, ascending: true)       ]     ) var projects: FetchedResults<Project>     public var body: some View {         NavigationView {             Form {                 Section(header: Text("Task Description")) {                   TextField("Task", text: $taskDescription)                 }                 Section(header: Text("Due Date")) {                     DatePicker("Select a due date", selection: $dueDate, in: Date()..., displayedComponents: .date).labelsHidden()                 }                 HStack {                     Spacer()                     Button(action: addMoveAction) {                         Text("Add Task").fontWeight(.bold)                                         .padding(10)                                         .foregroundColor(.white                                         .background(Color.blue)                                         .cornerRadius(10)                     }                     Spacer()                 }             }             .navigationBarTitle(Text("Create Task"), displayMode: .inline)             List {               ForEach(projects, id: \.self) { project in                     project.projectTitle.map(Text.init).font(Font.body.bold())             }         }     }   private func addMoveAction() {     onComplete(         taskDescription.isEmpty ? AddTask.DefaultTaskDescription : taskDescription,         dueDate == Date() ? AddTask.DefaultDueDate : dueDate     )   } } I'm not sure why trying to display the projects like it's done in ContentView is causing this issue
Jul ’20