How do I display this text? Please help

So im trying to make an assignments app and i also have a completed tab. If there are no assignments that are supposed to be displayed in the upcoming view, then I want to display a text that says that there are no assignments. But even if an assignment is completed, it still counts as an assignment, I just have it set not to come up under the upcoming tab. What do I do?

import SwiftUI

struct AssignmentListView: View {

    var Assignments: [assignmentClass]

    var Classes: [classesClass]

    @State var shouldBeCompleted: Bool

    var noEventsText: String

    var body: some View {

        ScrollView{

            VStack {

                if Assignments.count == 0 {

                    Text(noEventsText)

                        .bold()

                        .fontWeight(.medium)

                        .multilineTextAlignment(.center)

                        .padding(.top, 50)

                        .padding(.horizontal, 5)

                } else{

                    ForEach(Assignments) { madeAssignment in

                        if madeAssignment.isCompleted == shouldBeCompleted{

                        NavigationLink(destination: (AssignmentDetailView(madeAssignment: madeAssignment, classes: Classes))) {

                            AssignmentTileView(madeAssignment: madeAssignment, classes: Classes)

                        }

                        .buttonStyle(.plain)

}

                    }

                }

            }

            

            }

        }

    }

Could you first clarify:

If there are no assignments that are supposed to be displayed in the upcoming view, then I want to display a text that says that there are no assignments. But even if an assignment is completed, it still counts as an assignment

Do you mean "no pending assignment", as opposed to completed assignment ?

When you post code, please use the code formatter tool. That makes code much easier to read.

import SwiftUI
struct AssignmentListView: View {
    var Assignments: [assignmentClass]
    var Classes: [classesClass]
    @State var shouldBeCompleted: Bool
    var noEventsText: String

    var body: some View {
        ScrollView{
            VStack {
                if Assignments.count == 0 {
                    Text(noEventsText)
                        .bold()
                        .fontWeight(.medium)
                        .multilineTextAlignment(.center)
                        .padding(.top, 50)
                        .padding(.horizontal, 5)
                } else{
                    ForEach(Assignments) { madeAssignment in
                        if madeAssignment.isCompleted == shouldBeCompleted{
                        NavigationLink(destination: (AssignmentDetailView(madeAssignment: madeAssignment, classes: Classes))) {
                            AssignmentTileView(madeAssignment: madeAssignment, classes: Classes)
                        }
                        .buttonStyle(.plain)
}
                    }
                }
            }
            
            }
        }
    }

You should also start var names with lowerCase and class names with UpperCase:

    var assignments: [AssignmentClass] // Probably better named Assignment
    var classes: [classesClass] // probably better named Class

It is not clear either what you want to do with:

                        if madeAssignment.isCompleted == shouldBeCompleted {

Where is shouldBeCompleted modified ? When is it true or false ? Same question for madeAssignment.isCompleted.

In addition, you treat madeAssignment in the same way, whether it isCompleted or not. I do not understand the logic.

How do I display this text? Please help
 
 
Q