I'm stuck on something which should be trivial, using SwiftUI. I am pulling some data back from my API, and simply want to show each item on my view with ForEach.
I have the following function:
@State var workoutVideoList: GetWorkoutVideoListResponse!
func GetWorkoutVideoList() {
    loadingWorkoutVideoList = true
    
    PtPodsApiService.GetWorkoutList(firebaseToken: firebaseAuthToken) { (workoutListResult) -> () in
        DispatchQueue.main.async() {
            workoutVideoList = workoutListResult
            loadingWorkoutVideoList = false
        }
    }
}
I then want to show another view and pass this object into it:
if workoutVideoList != nil {
    BookAppointmentView(workoutVideoList: workoutVideoList)
}
else {
    Text("Nope")
}
For whatever reason, my main thread sees workoutVideoList as nil, even though it's been assigned. I thought using the dispatcher to assign it would solve the problem, but no joy!
Any idea what I'm doing wrong here?
Thanks