Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions Firestore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased
- [fixed] Marked all public classes with only readonly properties as `Sendable` to address
Swift Concurrency Check warning. (#12666)

# 11.0.0
- [removed] **Breaking change**: The deprecated `FirebaseFirestoreSwift` module
has been removed. See
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* A query that calculates aggregations over an underlying query.
*/
NS_SWIFT_SENDABLE
NS_SWIFT_NAME(AggregateQuery)
@interface FIRAggregateQuery : NSObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* The results of executing an `AggregateQuery`.
*/
NS_SWIFT_SENDABLE
NS_SWIFT_NAME(AggregateQuerySnapshot)
@interface FIRAggregateQuerySnapshot : NSObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
* A `CollectionReference` object can be used for adding documents, getting document references,
* and querying for documents (using the methods inherited from `Query`).
*/
NS_SWIFT_SENDABLE
NS_SWIFT_NAME(CollectionReference)
@interface FIRCollectionReference : FIRQuery

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ typedef NS_ENUM(NSInteger, FIRDocumentChangeType)
* A `DocumentChange` represents a change to the documents matching a query. It contains the
* document affected and the type of change that occurred (added, modified, or removed).
*/
NS_SWIFT_SENDABLE
NS_SWIFT_NAME(DocumentChange)
@interface FIRDocumentChange : NSObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ typedef void (^FIRDocumentSnapshotBlock)(FIRDocumentSnapshot *_Nullable snapshot
* a subcollection.
*/
NS_SWIFT_NAME(DocumentReference)
NS_SWIFT_SENDABLE
@interface FIRDocumentReference : NSObject

/** :nodoc: */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ typedef NS_ENUM(NSInteger, FIRServerTimestampBehavior) {
* For a `DocumentSnapshot` that points to a non-existing document, any data access will return
* `nil`. You can use the `exists` property to explicitly verify a documents existence.
*/
NS_SWIFT_SENDABLE
NS_SWIFT_NAME(DocumentSnapshot)
@interface FIRDocumentSnapshot : NSObject

Expand Down
1 change: 1 addition & 0 deletions Firestore/Source/Public/FirebaseFirestore/FIRGeoPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
* Latitude values are in the range of [-90, 90].
* Longitude values are in the range of [-180, 180].
*/
NS_SWIFT_SENDABLE
NS_SWIFT_NAME(GeoPoint)
@interface FIRGeoPoint : NSObject <NSCopying>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ typedef NS_ENUM(NSInteger, FIRLoadBundleTaskState) {

/** Represents a progress update or a final state from loading bundles. */
NS_SWIFT_NAME(LoadBundleTaskProgress)
NS_SWIFT_SENDABLE
@interface FIRLoadBundleTaskProgress : NSObject

/** How many documents have been loaded. */
Expand Down
1 change: 1 addition & 0 deletions Firestore/Source/Public/FirebaseFirestore/FIRQuery.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ typedef void (^FIRQuerySnapshotBlock)(FIRQuerySnapshot *_Nullable snapshot,
* A `Query` refers to a query which you can read or listen to. You can also construct
* refined `Query` objects by adding filters and ordering.
*/
NS_SWIFT_SENDABLE
NS_SWIFT_NAME(Query)
@interface FIRQuery : NSObject
/** :nodoc: */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
* using the `documents` property and its size can be inspected with `isEmpty` and
* `count`.
*/
NS_SWIFT_SENDABLE
NS_SWIFT_NAME(QuerySnapshot)
@interface FIRQuerySnapshot : NSObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ typedef NS_ENUM(NSUInteger, FIRListenSource) {
* of this class control settings like whether metadata-only changes trigger events and the
* preferred data source.
*/
NS_SWIFT_SENDABLE
NS_SWIFT_NAME(SnapshotListenOptions)
@interface FIRSnapshotListenOptions : NSObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
NS_ASSUME_NONNULL_BEGIN

/** Metadata about a snapshot, describing the state of the snapshot. */
NS_SWIFT_SENDABLE
NS_SWIFT_NAME(SnapshotMetadata)
@interface FIRSnapshotMetadata : NSObject

Expand Down
58 changes: 31 additions & 27 deletions Firestore/Swift/Tests/API/BasicCompileTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -493,36 +493,40 @@ func terminateDb(database db: Firestore) {
}
}

#if swift(>=5.5.2)
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
func testAsyncAwait(database db: Firestore) async throws {
try await db.enableNetwork()
try await db.disableNetwork()
try await db.waitForPendingWrites()
try await db.clearPersistence()
try await db.terminate()
try await db.runTransaction { _, _ in
0
}
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
func testAsyncAwait(database db: Firestore) async throws {
try await db.enableNetwork()
try await db.disableNetwork()
try await db.waitForPendingWrites()
try await db.clearPersistence()
try await db.terminate()
_ = try await db.runTransaction { _, _ in
0
}

let batch = db.batch()
try await batch.commit()
let batch = db.batch()
try await batch.commit()

_ = await db.getQuery(named: "foo")
_ = try await db.loadBundle(Data())
_ = await db.getQuery(named: "foo")
_ = try await db.loadBundle(Data())

let collection = db.collection("coll")
try await collection.getDocuments()
try await collection.getDocuments(source: FirestoreSource.default)
let collection = db.collection("coll")
try await collection.getDocuments()
try await collection.getDocuments(source: FirestoreSource.default)

let document = try await collection.addDocument(data: [:])
let document = try await collection.addDocument(data: [:])

try await document.setData([:])
try await document.setData([:], merge: true)
try await document.setData([:], mergeFields: [])
try await document.updateData([:])
try await document.delete()
try await document.getDocument()
try await document.getDocument(source: FirestoreSource.default)
try await document.setData([:])
try await document.setData([:], merge: true)
try await document.setData([:], mergeFields: [])
try await document.updateData([:])
try await document.delete()
try await document.getDocument()
try await document.getDocument(source: FirestoreSource.default)
}

actor regression12666 {
func getUser() async throws {
_ = try await Firestore.firestore().collection("users").getDocuments()
}
#endif
}