How can I get a maximum value from my object with a let?
var body: some View{
ZStack{
ForEach(schoolClasses, id: \.self) { studentList in
let oldestStudent = studentList.max { $0.age < $1.age } //this does not work, trying to return the oldest student
HStack{
//extra code to use the oldest student
}
}
}
}
How I can use that let value inside the HStack?
Right now it gives me build error: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions