Thank you to everyone but especially @malhal because I finally got it working with his fix! However, I did have to change that fix a little and wanted to update for anyone having a similar issue.
First of all, I used environmentObject and restructured my BeginWorkoutView, CreateTemplateView, and ContentView as suggested.
I originally had my WorkoutTemplate as a class, but name was NOT published. I tried using a struct but did not have success. I saw a different post(which i will link if i can find it again) point out that even if a view has an object that reacts to state changes (like my environment object in beginWorkoutView), the subview still might not react. BeginWorkoutView has a list of templateRowViews which show the template names. Originally, the template var was NOT an observedobject, so i updated that. i also decided to change WorkoutTemplate back to a class/conform to ObservableObject. Here are those additional changes/reversion
struct TemplateRowView: View {
@ObservedObject var template: WorkoutTemplate //now an @ObservedObject
var body: some View {
VStack{
Text(template.name).bold()
//other stuff
}
}
}
//kept as a class conforming to ObservableObject, made variable @Published
class WorkoutTemplate: Identifiable, Codable, Hashable, ObservableObject {
var id = UUID()
@Published var name: String
var workoutModules: [WorkoutModule]
var note: String?
//additional functions
}
I want to note, on the main screen where you see the template previews, name is only thing you see for each template, which is why it's the only thing i have published.
I hope this helps! I know theres a lot here and a lot I didnt include so please let me know if I can clarify something or you have a similar issue and want to see more code!