I have made a list in SwiftUI and I want to make the element views of list able to resize to show more information. Currently when I change the height they just start overlapping each other though. How can I make it so that when the view's height changes it updates the padding between list elements to keep it consistent. Below I have a screen shot of the overlap I am talking about and the relevant code:
here is where I create the list:
List{
//loop through task cards
ForEach(self.tasks, id: \.id) { task in
task
}
}
and here is the body code for the task cards that are shown in the list:
var height : CGFloat = 105
var body: some View {
RoundedRectangle(cornerRadius: 10)
.foregroundColor(Color.white)
.frame(height: self.completedLongPress ? self.height + 50 : self.height) // here is where height is changed
.overlay(
//content added in here (I don't think it's particularly important for the problem, but will edit if it's needed)
)
.gesture(self.longPress)
}