Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sending to returned values from async Storage APIs #14321

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions FirebaseStorage/Sources/AsyncAwait.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/// the task will be cancelled and an error will be thrown.
/// - Throws: An error if the operation failed, for example if the data exceeded `maxSize`.
/// - Returns: Data object.
func data(maxSize: Int64) async throws -> Data {
func data(maxSize: Int64) async throws -> sending Data {

Check failure on line 29 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

consecutive declarations on a line must be separated by ';'

Check failure on line 29 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

expected declaration
return try await withCheckedThrowingContinuation { continuation in
_ = self.getData(maxSize: maxSize) { result in
continuation.resume(with: result)
Expand All @@ -48,7 +48,8 @@
/// - Returns: StorageMetadata with additional information about the object being uploaded.
func putDataAsync(_ uploadData: Data,
metadata: StorageMetadata? = nil,
onProgress: ((Progress?) -> Void)? = nil) async throws -> StorageMetadata {
onProgress: ((Progress?) -> Void)? = nil) async throws
-> sending StorageMetadata {

Check failure on line 52 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

consecutive declarations on a line must be separated by ';'

Check failure on line 52 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

expected declaration
guard let onProgress = onProgress else {
return try await withCheckedThrowingContinuation { continuation in
self.putData(uploadData, metadata: metadata) { result in
Expand Down Expand Up @@ -86,7 +87,8 @@
/// - Returns: `StorageMetadata` with additional information about the object being uploaded.
func putFileAsync(from url: URL,
metadata: StorageMetadata? = nil,
onProgress: ((Progress?) -> Void)? = nil) async throws -> StorageMetadata {
onProgress: ((Progress?) -> Void)? = nil) async throws
-> sending StorageMetadata {

Check failure on line 91 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

consecutive declarations on a line must be separated by ';'

Check failure on line 91 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

expected declaration
guard let onProgress = onProgress else {
return try await withCheckedThrowingContinuation { continuation in
self.putFile(from: url, metadata: metadata) { result in
Expand Down Expand Up @@ -121,7 +123,7 @@
/// or `fileURL` did not reference a valid path on disk.
/// - Returns: A `URL` pointing to the file path of the downloaded file.
func writeAsync(toFile fileURL: URL,
onProgress: ((Progress?) -> Void)? = nil) async throws -> URL {
onProgress: ((Progress?) -> Void)? = nil) async throws -> sending URL {

Check failure on line 126 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

consecutive declarations on a line must be separated by ';'

Check failure on line 126 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

expected declaration
guard let onProgress = onProgress else {
return try await withCheckedThrowingContinuation { continuation in
_ = self.write(toFile: fileURL) { result in
Expand Down Expand Up @@ -160,7 +162,7 @@
/// - Throws: An error if the operation failed, for example if Storage was unreachable
/// or the storage reference referenced an invalid path.
/// - Returns: A `StorageListResult` containing the contents of the storage reference.
func list(maxResults: Int64) async throws -> StorageListResult {
func list(maxResults: Int64) async throws -> sending StorageListResult {

Check failure on line 165 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

consecutive declarations on a line must be separated by ';'

Check failure on line 165 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

expected declaration
typealias ListContinuation = CheckedContinuation<StorageListResult, Error>
return try await withCheckedThrowingContinuation { (continuation: ListContinuation) in
self.list(maxResults: maxResults) { result in
Expand All @@ -186,7 +188,7 @@
/// or the storage reference referenced an invalid path.
/// - Returns:
/// - completion A `Result` enum with either the list or an `Error`.
func list(maxResults: Int64, pageToken: String) async throws -> StorageListResult {
func list(maxResults: Int64, pageToken: String) async throws -> sending StorageListResult {
typealias ListContinuation = CheckedContinuation<StorageListResult, Error>
return try await withCheckedThrowingContinuation { (continuation: ListContinuation) in
self.list(maxResults: maxResults, pageToken: pageToken) { result in
Expand Down
Loading