I'm sending via AlamoFire an audio file to a REST API and get a JSON response. Meanwhile I would like to display a loading image (e.g. animated circle) until I receive the response. My current solution is so far:
let voiceData = try? Data(contentsOf: audioRecorder.url)
let uploadUrl = "<server ip>"
AF.upload(multipartFormData: { multipartFormData in
multipartFormData.append(voiceData!, withName: "file", fileName: "recording.m4a", mimeType: "audio/mpeg")
},
to: uploadUrl, method: .post)
.responseJSON { resp in
print(resp)
}
Now how can I show the loading image in my SwiftUI View?