I am attempting to assign the data from my Alamofire request to a dictionary of parameters, but it always shows up as nil.
var params = SomeParams()
params.addUserIds([currentUserID, partnerUserID])
params.name = name
Alamofire.request(url!, method: .get)
.validate()
.responseData(completionHandler: { (responseData) in
DispatchQueue.main.async {
params.coverImage = responseData.data!
}
})
// NIL RESPONSE
print(params)
I know that it's because the Alamofire call is being done in the background so I attempted to call the main thread and assign it. Yet it still doesn't work. Any ideas?