I have an error “declared closure result ‘()’ is incompatible with contextual type ‘Bool’

I am trying to code an assignments apps in swift playgrounds 4 and I received this error when trying to make a function that deletes an assignment. Here is the function

func deleteAssignment(madeAssignmnet: assignmentClass){

        if let index = Assignments.firstIndex(where: { assignmentClass -> Bool in

            return madeAssignmnet.id = assignmentClass.id

        }){

            Assignments.remove(at: index)

        }

    }

what's the problem?

Answered by Claude31 in 699418022

Change

madeAssignmnet.id = assignmentClass.id

into

madeAssignmnet.id == assignmentClass.id
Accepted Answer

Change

madeAssignmnet.id = assignmentClass.id

into

madeAssignmnet.id == assignmentClass.id
I have an error “declared closure result ‘()’ is incompatible with contextual type ‘Bool’
 
 
Q