ForEach<Range>
is constant range container (pay attention on below description of constructor), it is not allowed to modify it after construction.
extension ForEach where Data == Range<Int>, ID == Int, Content : View { /// Creates an instance that computes views on demand over a *constant* /// range. /// /// This instance only reads the initial value of `data` and so it does not /// need to identify views across updates. /// /// To compute views on demand over a dynamic range use /// `ForEach(_:id:content:)`. public init(_ data: Range<Int>, @ViewBuilder content: @escaping (Int) -> Content) }
If you want to modify container, you have to use ForEach(activeWorkout.exercises)