title: How to re-trigger function whenever a variable is updated
body: <p><strong>UPDATED</strong></p>
  <p>I'm pulling events from IOS calendar with EventKit. Working great.</p>
  <p>Here's the class function that retrieves the events.</p>
  <pre><code>@ObservedObject var selectDate = datepicker() // does NOT update as expected.
  </code></pre>
  <pre><code>func loadEvents(completion: @escaping (([EKEvent]?) -&gt; Void)) {
      requestAccess(onGranted: {
          let startOfDay = Calendar.current.startOfDay(for: self.selectDate.selectedDate)
          let endOfDay = Calendar.current.startOfDay(for: self.selectDate.selectedDate.advanced(by: TimeInterval.day))
          let predicate = self.eventStore.predicateForEvents(withStart: startOfDay, end: endOfDay, calendars: Array(self.selectedCalendars ?? []))
          let events = self.eventStore.events(matching: predicate)
  
          completion(events)
          print(&quot;loadEvents triggered for \(self.selectDate.selectedDate)&quot;) // This ALWAYS returns the current date
      }) {
          completion(nil)
      }
  }
  </code></pre>
  <p>I want to update the results based on a chosen date.
  so I have a date picker assigned to a @ObservedObject var <strong>selectDate</strong> in my main view</p>
  <pre><code>@ObservedObject var selectDate = datepicker()
  </code></pre>
  <pre><code>DatePicker(
      selection: $selectDate.selectedDate,
      in: dateClosedRange,
      displayedComponents: [.date, .hourAndMinute], label: { Text(&quot;Is hidden label&quot;) })
  }
  </code></pre>
  <p>And this class is acting as the middle man. The <code>didSet</code> method is triggering the function to run, confirmed by the print statement in the <code>loadEvents</code> func above.</p>
  <pre><code>class datepicker: ObservableObject {
      @Published var selectedDate: Date = Date() {
          didSet {
              print(&quot;class datepicker date changed to \(selectedDate)&quot;) // This returns the changed dates correctly
              EventsRepository.shared.loadAndUpdateEvents()
          }
      }
  }
  </code></pre>
  <p>I've tried passing the new date like this too.</p>
  <pre><code>let startOfDay = Calendar.current.startOfDay(for: datepicker.init().selectedDate)
  </code></pre>
  <p>With the same persistent &quot;current date&quot; only result.</p>
  <p>How can I pass the new selectedDate to the function whenever the <strong>selectDate.selectedDate</strong> from the datePicker is changed?</p>
  <p>At the moment it doesn't update at all. Always returns events for the current day only.</p>
  <p>The print statements contained in the above code in Debug return.</p>
  <pre><code>&quot;class datepicker date changed to 2020-08-13 19:23:28 +0000&quot; // YEP That's right. I used datePicker to select this date.
  &quot;loadEvents triggered for 2020-08-10 19:23:28 +0000&quot; // NOT updated, ALWAYS shows current date/time as first run. 
  </code></pre>
  <p>So it looks like @Published property is a constant and can not be changed once set. Is there an alternative?</p>