SwiftUI Index out of range in ForEach
问题 After hours of debugging I figured out the error is inside the foreach loop in MenuItemView in the folder ContentViews . The app crashes and the error is: Fatal error: Index out of range: file Swift/ContiguousArrayBuffer.swift, line 444 . Information: I have got an ObservableObject with an Array of Structs inside as data storage. The problem: The ForEach goes between 0 and the array count + 1. This is so I can have an extra item for adding new elements. In the ForEach is a check if the index