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)
}
}
}
}
}
}
}