title: iOS: How to get a specific string from a Data containing Strings and an image?
body: <p>I have that code that add values to body:</p>
  <pre><code>let body = NSMutableData()
  let mimetype = &quot;image/jpg&quot;
  
  //define the data post parameter
  
  body.append(&quot;--\(boundary)\r\n&quot;.data(using: String.Encoding.utf8)!)
  body.append(&quot;Content-Disposition:form-data; name=\&quot;eventId\&quot;\r\n\r\n&quot;.data(using: String.Encoding.utf8)!)
  body.append(&quot;\(eventId)\r\n&quot;.data(using: String.Encoding.utf8)!)
  
  body.append(&quot;--\(boundary)\r\n&quot;.data(using: String.Encoding.utf8)!)
  body.append(&quot;Content-Disposition:form-data; name=\&quot;contactId\&quot;\r\n\r\n&quot;.data(using: String.Encoding.utf8)!)
  body.append(&quot;\(contactId)\r\n&quot;.data(using: String.Encoding.utf8)!)
  
  body.append(&quot;--\(boundary)\r\n&quot;.data(using: String.Encoding.utf8)!)
  body.append(&quot;Content-Disposition:form-data; name=\&quot;type\&quot;\r\n\r\n&quot;.data(using: String.Encoding.utf8)!)
  body.append(&quot;\(type)\r\n&quot;.data(using: String.Encoding.utf8)!)
  
  body.append(&quot;--\(boundary)\r\n&quot;.data(using: String.Encoding.utf8)!)
  body.append(&quot;Content-Disposition:form-data; name=\&quot;file\&quot;; filename=\&quot;\(fileName)\&quot;\r\n&quot;.data(using: String.Encoding.utf8)!)
  body.append(&quot;Content-Type: \(mimetype)\r\n\r\n&quot;.data(using: String.Encoding.utf8)!)
  body.append(image_data!)
  body.append(&quot;\r\n&quot;.data(using: String.Encoding.utf8)!)
  
  body.append(&quot;--\(boundary)--\r\n&quot;.data(using: String.Encoding.utf8)!)
  
  request.httpBody = body as Data
  </code></pre>
  <p>How to convert it in string? I would like to get the boundary, but impossible to do it.</p>
  <p>When I do that, it makes me nil:  <code>let test = String(data: body as Data, encoding: .utf8)</code></p>