Delay view removal transition animation

Viewed 31

How to delay animation of view removal transition by, say, 2 seconds? I want to delay only the removal animation, and not an insertion. I suspect i need to use transaction modifier. I have code like this:

@EnvironmentObject var model: Model

var body: some View {
  LazyVGrid(columns: columns(), alignment: .center, spacing: 0) {
    ForEach(model.elements) { e in
      Rectangle()
        .fill(e.color)
        .frame(width: 20, height: 20)
        .transition(.asymmetric(insertion: .identity, removal: .identity))
        .transaction { transaction in
            // How to delay removal transition animation?
        }
    }
  }
}
0 Answers
Related