title: Passing multiple closures in swift function and perform filtering
body: <p>In my code, I have a protocol function search. I want to pass multiple closures that can perform filtering process.</p>
  <p>There are few things I am confused.
  Firstly how to send a generic array of closures into search function. Secondly how will I iterate over each closure to perform the filtering process of each array element.</p>
  <p>I have a function</p>
  <pre><code>func search(query: String, mainDataList:[T], ____ closuersArray, completionHandler: @escaping ([T]?, Error?) -&gt; Void)  
  {
      let queue = DispatchQueue(label: &quot;SomeQueue&quot;, attributes: .concurrent)
      queue.asyncAfter(deadline: .now() + 0.3, execute: {
                  
              var dataList : [T] = []
              // Perform filtering
       
              for clouser in closuersArray {
                   // Do something here.
              }
  
              DispatchQueue.main.async {
                  completionHandler(dataList, nil)
              }
          })
          
          
  }
  </code></pre>
  <p>A couple of random functions as closures are defined as</p>
  <pre><code>    func containsDataClosuer(query: String, model: T) -&gt; Bool {
         // Do something here
         return false
      }
      
      func someOtherClouser(query: String, model: T) -&gt; Bool {
         // Do something here
         return false
  }
  </code></pre>