title: How can I scrollToTop in SwiftUI
body: <p>I am learning SwiftUI, but I have a problem... How can I scroll to top in <code>ScrollView</code> when the <code>SegmentedControl</code> value changed?</p>
  
  <p>This is code for the main view to show Data:</p>
  
  <pre><code>var body: some View {
      NavigationView {
          SegmentedControl(selection: $selected) {
              Text("Food").tag(0)
              Text("Drinks").tag(1)
              Text("Wines").tag(2)
              }
              .padding()
          ScrollView {
              VStack(alignment: .center) {
                  if selected == 0 {
                      ForEach (persons) {
                          AnyCell(person: $0, animal: nil, wine: nil)
                      }
                  } else if selected == 1 {
                      ForEach (animals) {
                          AnyCell(person: nil, animal: $0, wine: nil)
                      }
                  } else {
                      ForEach (wines) {
                          AnyCell(person: nil, animal: nil, wine: $0)
                      }
                  }
              }
              }
              .navigationBarTitle(Text("Food list"), displayMode: .inline)
      }
  }
  </code></pre>
  
  <p>Thank you</p>