-
Is it a way to upload files using async/await? Thank you! |
Beta Was this translation helpful? Give feedback.
Answered by
s4cha
Apr 11, 2023
Replies: 1 comment 1 reply
-
Hey, the api is not available per se (yet) but there is a way to use an func updateAvatar(user: User, data: Data) async throws {
let multipart = MultipartData(name: "avatar", fileData: data, fileName: "photo.jpg", mimeType: "image/jpeg")
for try await (data, progress) in network.put("users/\(user.id)/avatar", multipartData: multipart).values where data != nil {
break
}
} Hope this helps :) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
loganx510
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, the api is not available per se (yet) but there is a way to use an
AnyPublisher
api in an async-await fashion viavalues
property. Here is an example below:Hope this helps :)