title: How to pause/resume a DispatchWorkItem in Swift
body: <p>I have this object:</p>
  
  <pre><code>lockWallTask = DispatchWorkItem(block: {
          self.lockWall()
      })
      DispatchQueue.main.asyncAfter(deadline: .now() + 10, execute: lockWallTask)
  </code></pre>
  
  <p>So it is executing after 10 seconds. However, I am trying to pause this item and then resume it. For instance:</p>
  
  <p>I would pause the item after 3 seconds, meaning there is 7 seconds left for execution. I do other stuff for like 5 minutes and then I <strong>resume the item and there is still 7 seconds left for execution.</strong> I was trying to achieve this life this:</p>
  
  <pre><code>DispatchQueue.resume(task)
  
  DispatchQueue.suspend(task)
  </code></pre>
  
  <p>However, I was given this compile error:</p>
  
  <p><a href="https://i.stack.imgur.com/hUTdh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hUTdh.png" alt="enter image description here"></a></p>
  
  <p>I don't understand that error. The variable <strong><em>task</em></strong> is of type 'DispatchWorkItem'</p>
  
  <p><strong>How would I achieve pausing, or suspending, a DispatchWorkItem and then resuming it?</strong> </p>