title: How to set timer in one vc and fire it in another vc
body: <p>my goal is to set a timer in one vc when a firestore document is created and fire it in another vc when the timer is up to delete the firestore document.</p>
  <p>In my vc where I create the document, I have this block of code in the button that creates the document in firestore:</p>
  <pre><code>db.collection(&quot;school_users/\(user?.uid)/events&quot;).addDocument(data: [&quot;event_name&quot;: nameTextField.text, &quot;event_date&quot;: dateTextField.text, &quot;event_cost&quot;: costTextField.text, &quot;for_grades&quot;: gradesTextField.text, &quot;school_id&quot;: schoolIDTextF.text, &quot;time_created&quot;: Date()]) { (error) in
                  if error != nil {
                      self.showError(&quot;There was an error trying to add user data to the system.&quot;)
                  } else {
                      self.setTimerForEventDeletion()
                      self.dismiss(animated: true, completion: nil)
                  }
              }
  </code></pre>
  <p>The <code>setTimerForEventDeletion()</code> function contains this :</p>
  <pre><code>  func setTimerForEventDeletion() {
      let date = dateTextField.text!
     let dateToDelete = formatter.date(from: date)!
      let timer = Timer(fireAt: dateToDelete, interval: 0, target: self, selector: #selector(callDeleteEventFunction), userInfo: nil, repeats: false)
      
  }
  </code></pre>
  <p>The date format is correct as well I already have all that setup. For the objc method, I call another function from a different vc (will explain) in that function.</p>
  <pre><code> @objc func callDeleteEventFunction() {
      otherVC.deleteEventAtEventTime()
  }
  </code></pre>
  <p>The reason I call this function from the other vc is because the other vc is storing the details of the created document, you can't fetch the details of a document that isn't created yet, so I have it in another VC. The function looks like this...</p>
  <pre><code>@objc func deleteEventAtEventTime() {
      db.document(&quot;school_users/\(user?.uid)/events/\(selectedEventDocID!)&quot;).delete { (error) in
          if let error = error {
              print(&quot;There was an error deleting the doc: \(error)&quot;)
          } else {
              print(&quot;Doc deleted!&quot;)
          }
      }
  
  }
  </code></pre>
  <p>Now before posting this question, I tested it by firing the timer in the same vc that stores the document details and it worked, but when I exited that vc, the cell deleted and the tableview shrank, basically glitching out the app, and eventually crashed when I clicked another cell with different details.</p>
  <p>So i want to be able to have the timer be set when the document is created in one vc, and have the timer fire in another vc when the deletion date arrives.</p>