Skip to content

Commit 12c52b9

Browse files
committed
Add sending to async Storage APIs
1 parent 0d885d2 commit 12c52b9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

FirebaseStorage/Sources/AsyncAwait.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public extension StorageReference {
2626
/// the task will be cancelled and an error will be thrown.
2727
/// - Throws: An error if the operation failed, for example if the data exceeded `maxSize`.
2828
/// - Returns: Data object.
29-
func data(maxSize: Int64) async throws -> Data {
29+
func data(maxSize: Int64) async throws -> sending Data {
3030
return try await withCheckedThrowingContinuation { continuation in
3131
_ = self.getData(maxSize: maxSize) { result in
3232
continuation.resume(with: result)
@@ -48,7 +48,7 @@ public extension StorageReference {
4848
/// - Returns: StorageMetadata with additional information about the object being uploaded.
4949
func putDataAsync(_ uploadData: Data,
5050
metadata: StorageMetadata? = nil,
51-
onProgress: ((Progress?) -> Void)? = nil) async throws -> StorageMetadata {
51+
onProgress: ((Progress?) -> Void)? = nil) async throws -> sending StorageMetadata {
5252
guard let onProgress = onProgress else {
5353
return try await withCheckedThrowingContinuation { continuation in
5454
self.putData(uploadData, metadata: metadata) { result in
@@ -86,7 +86,7 @@ public extension StorageReference {
8686
/// - Returns: `StorageMetadata` with additional information about the object being uploaded.
8787
func putFileAsync(from url: URL,
8888
metadata: StorageMetadata? = nil,
89-
onProgress: ((Progress?) -> Void)? = nil) async throws -> StorageMetadata {
89+
onProgress: ((Progress?) -> Void)? = nil) async throws -> sending StorageMetadata {
9090
guard let onProgress = onProgress else {
9191
return try await withCheckedThrowingContinuation { continuation in
9292
self.putFile(from: url, metadata: metadata) { result in
@@ -121,7 +121,7 @@ public extension StorageReference {
121121
/// or `fileURL` did not reference a valid path on disk.
122122
/// - Returns: A `URL` pointing to the file path of the downloaded file.
123123
func writeAsync(toFile fileURL: URL,
124-
onProgress: ((Progress?) -> Void)? = nil) async throws -> URL {
124+
onProgress: ((Progress?) -> Void)? = nil) async throws -> sending URL {
125125
guard let onProgress = onProgress else {
126126
return try await withCheckedThrowingContinuation { continuation in
127127
_ = self.write(toFile: fileURL) { result in
@@ -160,7 +160,7 @@ public extension StorageReference {
160160
/// - Throws: An error if the operation failed, for example if Storage was unreachable
161161
/// or the storage reference referenced an invalid path.
162162
/// - Returns: A `StorageListResult` containing the contents of the storage reference.
163-
func list(maxResults: Int64) async throws -> StorageListResult {
163+
func list(maxResults: Int64) async throws -> sending StorageListResult {
164164
typealias ListContinuation = CheckedContinuation<StorageListResult, Error>
165165
return try await withCheckedThrowingContinuation { (continuation: ListContinuation) in
166166
self.list(maxResults: maxResults) { result in
@@ -186,7 +186,7 @@ public extension StorageReference {
186186
/// or the storage reference referenced an invalid path.
187187
/// - Returns:
188188
/// - completion A `Result` enum with either the list or an `Error`.
189-
func list(maxResults: Int64, pageToken: String) async throws -> StorageListResult {
189+
func list(maxResults: Int64, pageToken: String) async throws -> sending StorageListResult {
190190
typealias ListContinuation = CheckedContinuation<StorageListResult, Error>
191191
return try await withCheckedThrowingContinuation { (continuation: ListContinuation) in
192192
self.list(maxResults: maxResults, pageToken: pageToken) { result in

0 commit comments

Comments
 (0)