title: Is there a specific way to append DispatchWorkItems to a DispatchQueue instead of re declaring them in code?
body: <p>I have several Dispatch work items to execute on a queue i don't want to redeclare the codes, i want to pass them to an array or list of <code>DispatchWorkItems</code> and then inject it to a dispatch queue is there any way to achieve this ?</p>
  
  <pre><code>    func executeDispatchWorkItem(url: String, completion  : @escaping  (Result&lt;String,Error&gt;)-&gt; Void,beganHandler  : @escaping  (String)-&gt; Void){
  
  do {
      beganHandler("\(url) Began to execute ")
      let content = try String(contentsOf:URL(string: url)!)
      completion(.success(content))
  }
  catch let error {
          completion(.failure(error))
  }
  sleep(1)
  
   }
  
     var serialQueue = DispatchQueue(label: "A queue")
  
    serialQueue.async {
  executeDispatchWorkItem(url: "https://www.google.com/",completion: 
  {data in
  
      switch data {
      case .success(let data):
          print("URL : \(data) completed  with \(String(describing: data))")
      case .failure(let error ):
          print("URL : \(error.localizedDescription) failed  with \(error.localizedDescription)")
      }
  
  }, beganHandler: { me in
          print("\(me) began to execute ")
  })
  
  executeDispatchWorkItem(url: "www.facebook.com",completion: {data in
  
      switch data {
      case .success(let data):
          print("URL : \(data) completed  with \(String(describing: 
  data))")
      case .failure(let error ):
          print("URL : \(error.localizedDescription) failed  with \(error.localizedDescription)")
      }
  
  }, beganHandler: { me in
          print("\(me) began to execute ")
  })
  executeDispatchWorkItem(url: "www.youtube.com",completion: {data in
  
      switch data {
      case .success(let data):
          print("URL : \(data) completed  with \(String(describing: data))")
      case .failure(let error ):
          print("URL : \(error.localizedDescription) failed  with \(error.localizedDescription)")
      }
  
  }, beganHandler: { me in
          print("\(me) began to execute ")
  })
  </code></pre>
  
  <p>/// HOW EVER I WANT TO ACHIEVE SOMETHING LIKE THIS </p>
  
  <pre><code>let itemsToExecute : [DispatchWorkItem] = [dispatch1.dispatch2]
  </code></pre>
  
  <p>// IS THIS POSSIBLE ?</p>
  
  <pre><code>serialQueue.sync(execute: itemsToExecute) ?
  </code></pre>