title: How can I link a set of toggles to a progress view - Xcode
body: <p>The title tells you basically everything. I am making a task tracker app and would like the amount of undone tasks to be how full the bar is. In case it is needed a true toggle is a 'undone' task (this is part of a larger app where there is also a timetable tracker).</p>
  <p>I am working on Xcode 13.3 building for iPad</p>
  <pre><code>struct PeriodView: View {
      // task
      @State private var current = 0.0
      @State private var minValue = 0.0
      @State private var maxValue = 13.0
      @State private var track = 1.0
      // task var
      @State var re = false
      @State var science = false
      @State var maths = false
      @State var english = false
      @State var history = false
      @State var geography = false
      @State var dt = false
      @State var art = false
      @State var computeing = true
      @State var drama = false
      @State var music = true
      @State var french = false
      @State private var german = false
      // progress bar each part is 7.6923076923
      @State var progress = 0.0
      //Selected Day for Picker
      @State var selectedday: Day? = nil
      //TabView selection
      @State var selection: Options = .list
      //Contains a filtered list if `selectedday != nil`
      var filteredSchedule: [Period]{
          schedule.filter({ period in
              if let selectedday = selectedday {
                  return period.day.weekday == selectedday.weekday &amp;&amp; period.day.schedule == selectedday.schedule
              }else{
                  return true
              }
          })
      }
      var body: some View {
              //task
              //scroll view
              HStack {
                  VStack {
                      VStack {
                          Toggle(&quot;Re&quot;, isOn: $re)
                              .padding(.horizontal)
                          Toggle(&quot;Science&quot;, isOn: $science)
                              .padding(.horizontal)
                          Toggle(&quot;Maths&quot;, isOn: $maths)
                              .padding(.horizontal)
                          Toggle(&quot;English&quot;, isOn: $english)
                              .padding(.horizontal)
                          Toggle(&quot;History&quot;, isOn: $history)
                              .padding(.horizontal)
                          Toggle(&quot;Geography&quot;, isOn: $geography)
                              .padding(.horizontal)
                          Toggle(&quot;Dt&quot;, isOn: $dt)
                              .padding(.horizontal)
                      }
                      VStack {
                          Toggle(&quot;Art&quot;, isOn: $art)
                              .padding(.horizontal)
                          Toggle(&quot;Computeing&quot;, isOn: $computeing)
                              .padding(.horizontal)
                          Toggle(&quot;French&quot;, isOn: $french)
                              .padding(.horizontal)
                          Toggle(&quot;German&quot;, isOn: $german)
                              .padding(.horizontal)
                          Toggle(&quot;Music&quot;, isOn: $music)
                              .padding(.horizontal)
                          Toggle(&quot;Drama&quot;, isOn: $drama)
                              .padding(.horizontal)
                      }
                  }//end of task selector
                  //middle column
                  VStack{
                      ProgressView(value: progress)
                          .padding(.all)
                  }
  </code></pre>