title: Pass MultipartformData to Alamofire.upload
body: <p>I've to convert a quite big project with different types of data that needs to be uploaded as multiparts. For that I've created several structs that build the needed <code>MultipartFormData</code> objects.</p>
  
  <p>Some of the uploads are rather small, others are bigger. So I'm looking into using the <code>.upload()</code> method of Alamofire (v4).</p>
  
  <p>That method has a closure to append parts to the <code>multipartFormData</code> object.</p>
  
  <pre><code>Alamofire.upload(
     multipartFormData: { multipartFormData in
              // do stuff here
     }
  </code></pre>
  
  <p>But I haven't found a way to pass my existing <code>MultipartformData</code> object to this method.</p>
  
  <p>It should be like:</p>
  
  <pre><code>self.parts = MultipartformData()
  ...
  // do stuff with self.parts
  ...
  
  Alamofire.upload(
     multipartFormData: { multipartFormData in
              multipartFormData = self.parts
     }
  </code></pre>
  
  <p>But that doesn't work as I'm getting the following error message:</p>
  
  <blockquote>
    <p>parameters may not have the 'var' specifier</p>
  </blockquote>
  
  <p>I'm using XCode 8.1, Alamofire 4 and Swift 3.</p>
  
  <p>Thanks!</p>