How do you do an animated transition for a section of a form in SwiftUI?

I have a SwiftUI form that looks like this:

var body: some View {
  Form {
    Section {
      if !foo {
        ...
      }
    }

    Section {
      ...
    }

    Section {
      ...
    }
  }
}

When foo is true the first section of the form appears. Conversely when foo is false the first section disappears.

This code works correctly. However the appearing and disappearing of the first section is too sudden. How do I enable a smoother, animated transition?

Any help on improving this code would be appreciated.

How do you do an animated transition for a section of a form in SwiftUI?
 
 
Q