title: Swift UI and Alamofire Image Upload
body: <p>I'm new to Swift and decided to try Alamofire for networking in my project. I've checked a lot of guides on the web, but most of them are outdated and use UIImage instead of Swift UI Image type.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>@State var image: Image? = nil
  </code></pre>
  
  <p>....</p>
  
  <pre><code>AF.upload(multipartFormData: { multipartFormData in
                  multipartFormData.append(Data(self.name.utf8), withName: "name")
                  multipartFormData.append(Data(self.price.utf8), withName: "price")
                  multipartFormData.append(Data(self.image!), withName: "image")
              }, to: upload_url, headers: headers)
  
                  .responseDecodable(of: WishModel.self) { response in
                      debugPrint(response)
                  }
  </code></pre>
  
  <p>Apparently Data struct from Alamofire doesn't support this type.</p>
  
  <p><code>Cannot invoke initializer for type 'Data' with an argument list of type '(Image)'</code></p>
  
  <p>Also, I couldn't find any methods that can convert Image into Base64 type. Is the only way to solve this issue to replace all Image instances into UIImage? </p>