Skip to content

Commit 78cc446

Browse files
authored
Update Firestore's public headers to use Swift class names. (#9544)
* Update Firestore's public headers to use Swift class names. * Address comments.
1 parent 020a5ee commit 78cc446

17 files changed

+273
-275
lines changed

Firestore/Source/Public/FirebaseFirestore/FIRCollectionReference.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
2323
@class FIRDocumentReference;
2424

2525
/**
26-
* A `FIRCollectionReference` object can be used for adding documents, getting document references,
27-
* and querying for documents (using the methods inherited from `FIRQuery`).
26+
* A `CollectionReference` object can be used for adding documents, getting document references,
27+
* and querying for documents (using the methods inherited from `Query`).
2828
*/
2929
NS_SWIFT_NAME(CollectionReference)
3030
@interface FIRCollectionReference : FIRQuery
@@ -36,42 +36,42 @@ NS_SWIFT_NAME(CollectionReference)
3636
@property(nonatomic, strong, readonly) NSString *collectionID;
3737

3838
/**
39-
* For subcollections, `parent` returns the containing `FIRDocumentReference`. For root
40-
* collections, nil is returned.
39+
* For subcollections, `parent` returns the containing `DocumentReference`. For root collections,
40+
* `nil` is returned.
4141
*/
4242
@property(nonatomic, strong, nullable, readonly) FIRDocumentReference *parent;
4343

4444
/**
45-
* A string containing the slash-separated path to this this `FIRCollectionReference` (relative to
46-
* the root of the database).
45+
* A string containing the slash-separated path to this this `CollectionReference` (relative to the
46+
* root of the database).
4747
*/
4848
@property(nonatomic, strong, readonly) NSString *path;
4949

5050
/**
51-
* Returns a FIRDocumentReference pointing to a new document with an auto-generated ID.
51+
* Returns a `DocumentReference` pointing to a new document with an auto-generated ID.
5252
*
53-
* @return A FIRDocumentReference pointing to a new document with an auto-generated ID.
53+
* @return A `DocumentReference` pointing to a new document with an auto-generated ID.
5454
*/
5555
- (FIRDocumentReference *)documentWithAutoID NS_SWIFT_NAME(document());
5656

5757
/**
58-
* Gets a `FIRDocumentReference` referring to the document at the specified path, relative to this
58+
* Gets a `DocumentReference` referring to the document at the specified path, relative to this
5959
* collection's own path.
6060
*
6161
* @param documentPath The slash-separated relative path of the document for which to get a
62-
* `FIRDocumentReference`.
62+
* `DocumentReference`.
6363
*
64-
* @return The `FIRDocumentReference` for the specified document path.
64+
* @return The `DocumentReference` for the specified document path.
6565
*/
6666
- (FIRDocumentReference *)documentWithPath:(NSString *)documentPath NS_SWIFT_NAME(document(_:));
6767

6868
/**
6969
* Adds a new document to this collection with the specified data, assigning it a document ID
7070
* automatically.
7171
*
72-
* @param data An `NSDictionary` containing the data for the new document.
72+
* @param data A `Dictionary` containing the data for the new document.
7373
*
74-
* @return A `FIRDocumentReference` pointing to the newly created document.
74+
* @return A `DocumentReference` pointing to the newly created document.
7575
*/
7676
- (FIRDocumentReference *)addDocumentWithData:(NSDictionary<NSString *, id> *)data
7777
NS_SWIFT_NAME(addDocument(data:));
@@ -80,12 +80,12 @@ NS_SWIFT_NAME(CollectionReference)
8080
* Adds a new document to this collection with the specified data, assigning it a document ID
8181
* automatically.
8282
*
83-
* @param data An `NSDictionary` containing the data for the new document.
83+
* @param data A `Dictionary` containing the data for the new document.
8484
* @param completion A block to execute once the document has been successfully written to
8585
* the server. This block will not be called while the client is offline, though local
8686
* changes will be visible immediately.
8787
*
88-
* @return A `FIRDocumentReference` pointing to the newly created document.
88+
* @return A `DocumentReference` pointing to the newly created document.
8989
*/
9090
// clang-format off
9191
// clang-format breaks the NS_SWIFT_NAME attribute

Firestore/Source/Public/FirebaseFirestore/FIRDocumentChange.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ typedef NS_ENUM(NSInteger, FIRDocumentChangeType)
4040
} NS_SWIFT_NAME(DocumentChangeType);
4141

4242
/**
43-
* A `FIRDocumentChange` represents a change to the documents matching a query. It contains the
43+
* A `DocumentChange` represents a change to the documents matching a query. It contains the
4444
* document affected and the type of change that occurred (added, modified, or removed).
4545
*/
4646
NS_SWIFT_NAME(DocumentChange)
@@ -56,16 +56,16 @@ NS_SWIFT_NAME(DocumentChange)
5656
@property(nonatomic, strong, readonly) FIRQueryDocumentSnapshot *document;
5757

5858
/**
59-
* The index of the changed document in the result set immediately prior to this FIRDocumentChange
60-
* (i.e. supposing that all prior FIRDocumentChange objects have been applied). NSNotFound for
61-
* FIRDocumentChangeTypeAdded events.
59+
* The index of the changed document in the result set immediately prior to this `DocumentChange`
60+
* (i.e. supposing that all prior `DocumentChange` objects have been applied). `NSNotFound` for
61+
* `DocumentChangeTypeAdded` events.
6262
*/
6363
@property(nonatomic, readonly) NSUInteger oldIndex;
6464

6565
/**
66-
* The index of the changed document in the result set immediately after this FIRDocumentChange
67-
* (i.e. supposing that all prior FIRDocumentChange objects and the current FIRDocumentChange object
68-
* have been applied). NSNotFound for FIRDocumentChangeTypeRemoved events.
66+
* The index of the changed document in the result set immediately after this `DocumentChange`
67+
* (i.e. supposing that all prior `DocumentChange` objects and the current `DocumentChange` object
68+
* have been applied). `NSNotFound` for `DocumentChangeTypeRemoved` events.
6969
*/
7070
@property(nonatomic, readonly) NSUInteger newIndex;
7171

Firestore/Source/Public/FirebaseFirestore/FIRDocumentReference.h

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ typedef void (^FIRDocumentSnapshotBlock)(FIRDocumentSnapshot *_Nullable snapshot
3232
NSError *_Nullable error);
3333

3434
/**
35-
* A `FIRDocumentReference` refers to a document location in a Firestore database and can be
35+
* A `DocumentReference` refers to a document location in a Firestore database and can be
3636
* used to write, read, or listen to the location. The document at the referenced location
37-
* may or may not exist. A `FIRDocumentReference` can also be used to create a
38-
* `FIRCollectionReference` to a subcollection.
37+
* may or may not exist. A `DocumentReference` can also be used to create a `CollectionReference` to
38+
* a subcollection.
3939
*/
4040
NS_SWIFT_NAME(DocumentReference)
4141
@interface FIRDocumentReference : NSObject
@@ -50,7 +50,7 @@ NS_SWIFT_NAME(DocumentReference)
5050
/** A reference to the collection to which this `DocumentReference` belongs. */
5151
@property(nonatomic, strong, readonly) FIRCollectionReference *parent;
5252

53-
/** The `FIRFirestore` for the Firestore database (useful for performing transactions, etc.). */
53+
/** The `Firestore` for the Firestore database (useful for performing transactions, etc.). */
5454
@property(nonatomic, strong, readonly) FIRFirestore *firestore;
5555

5656
/**
@@ -60,35 +60,35 @@ NS_SWIFT_NAME(DocumentReference)
6060
@property(nonatomic, strong, readonly) NSString *path;
6161

6262
/**
63-
* Gets a `FIRCollectionReference` referring to the collection at the specified
64-
* path, relative to this document.
63+
* Gets a `CollectionReference` referring to the collection at the specified path, relative to this
64+
* document.
6565
*
6666
* @param collectionPath The slash-separated relative path of the collection for which to get a
67-
* `FIRCollectionReference`.
67+
* `CollectionReference`.
6868
*
69-
* @return The `FIRCollectionReference` at the specified _collectionPath_.
69+
* @return The `CollectionReference` at the specified _collectionPath_.
7070
*/
7171
- (FIRCollectionReference *)collectionWithPath:(NSString *)collectionPath
7272
NS_SWIFT_NAME(collection(_:));
7373

7474
#pragma mark - Writing Data
7575

7676
/**
77-
* Writes to the document referred to by `FIRDocumentReference`. If the document doesn't yet exist,
77+
* Writes to the document referred to by `DocumentReference`. If the document doesn't yet exist,
7878
* this method creates it and then sets the data. If the document exists, this method overwrites
7979
* the document data with the new values.
8080
*
81-
* @param documentData An `NSDictionary` that contains the fields and data to write to the
81+
* @param documentData A `Dictionary` that contains the fields and data to write to the
8282
* document.
8383
*/
8484
- (void)setData:(NSDictionary<NSString *, id> *)documentData;
8585

8686
/**
87-
* Writes to the document referred to by this DocumentReference. If the document does not yet
88-
* exist, it will be created. If you pass `merge:YES`, the provided data will be merged into
87+
* Writes to the document referred to by this `DocumentReference`. If the document does not yet
88+
* exist, it will be created. If you pass `merge:true`, the provided data will be merged into
8989
* any existing document.
9090
*
91-
* @param documentData An `NSDictionary` that contains the fields and data to write to the
91+
* @param documentData A `Dictionary` that contains the fields and data to write to the
9292
* document.
9393
* @param merge Whether to merge the provided data into any existing document. If enabled,
9494
* all omitted fields remain untouched. If your input sets any field to an empty dictionary, any
@@ -105,20 +105,20 @@ NS_SWIFT_NAME(DocumentReference)
105105
* It is an error to include a field in `mergeFields` that does not have a corresponding
106106
* value in the `data` dictionary.
107107
*
108-
* @param documentData An `NSDictionary` containing the fields that make up the document
108+
* @param documentData A `Dictionary` containing the fields that make up the document
109109
* to be written.
110-
* @param mergeFields An `NSArray` that contains a list of `NSString` or `FIRFieldPath` elements
110+
* @param mergeFields An `Array` that contains a list of `String` or `FieldPath` elements
111111
* specifying which fields to merge. Fields can contain dots to reference nested fields within
112112
* the document. If your input sets any field to an empty dictionary, any nested field is
113113
* overwritten.
114114
*/
115115
- (void)setData:(NSDictionary<NSString *, id> *)documentData mergeFields:(NSArray<id> *)mergeFields;
116116

117117
/**
118-
* Overwrites the document referred to by this `FIRDocumentReference`. If no document exists, it
118+
* Overwrites the document referred to by this `DocumentReference`. If no document exists, it
119119
* is created. If a document already exists, it is overwritten.
120120
*
121-
* @param documentData An `NSDictionary` containing the fields that make up the document
121+
* @param documentData A `Dictionary` containing the fields that make up the document
122122
* to be written.
123123
* @param completion A block to execute once the document has been successfully written to the
124124
* server. This block will not be called while the client is offline, though local
@@ -128,11 +128,11 @@ NS_SWIFT_NAME(DocumentReference)
128128
completion:(nullable void (^)(NSError *_Nullable error))completion;
129129

130130
/**
131-
* Writes to the document referred to by this DocumentReference. If the document does not yet
132-
* exist, it will be created. If you pass `merge:YES`, the provided data will be merged into
131+
* Writes to the document referred to by this `DocumentReference`. If the document does not yet
132+
* exist, it will be created. If you pass `merge:true`, the provided data will be merged into
133133
* any existing document.
134134
*
135-
* @param documentData An `NSDictionary` containing the fields that make up the document
135+
* @param documentData A `Dictionary` containing the fields that make up the document
136136
* to be written.
137137
* @param merge Whether to merge the provided data into any existing document. If your input sets
138138
* any field to an empty dictionary, any nested field is overwritten.
@@ -153,9 +153,9 @@ NS_SWIFT_NAME(DocumentReference)
153153
* It is an error to include a field in `mergeFields` that does not have a corresponding
154154
* value in the `data` dictionary.
155155
*
156-
* @param documentData An `NSDictionary` containing the fields that make up the document
156+
* @param documentData A `Dictionary` containing the fields that make up the document
157157
* to be written.
158-
* @param mergeFields An `NSArray` that contains a list of `NSString` or `FIRFieldPath` elements
158+
* @param mergeFields An `Array` that contains a list of `String` or `FieldPath` elements
159159
* specifying which fields to merge. Fields can contain dots to reference nested fields within
160160
* the document. If your input sets any field to an empty dictionary, any nested field is
161161
* overwritten.
@@ -168,20 +168,20 @@ NS_SWIFT_NAME(DocumentReference)
168168
completion:(nullable void (^)(NSError *_Nullable error))completion;
169169

170170
/**
171-
* Updates fields in the document referred to by this `FIRDocumentReference`.
171+
* Updates fields in the document referred to by this `DocumentReference`.
172172
* If the document does not exist, the update fails (specify a completion block to be notified).
173173
*
174-
* @param fields An `NSDictionary` containing the fields (expressed as an `NSString` or
175-
* `FIRFieldPath`) and values with which to update the document.
174+
* @param fields A `Dictionary` containing the fields (expressed as an `String` or
175+
* `FieldPath`) and values with which to update the document.
176176
*/
177177
- (void)updateData:(NSDictionary<id, id> *)fields;
178178

179179
/**
180-
* Updates fields in the document referred to by this `FIRDocumentReference`. If the document
180+
* Updates fields in the document referred to by this `DocumentReference`. If the document
181181
* does not exist, the update fails and the specified completion block receives an error.
182182
*
183-
* @param fields An `NSDictionary` containing the fields (expressed as an `NSString` or
184-
* `FIRFieldPath`) and values with which to update the document.
183+
* @param fields A `Dictionary` containing the fields (expressed as a `String` or
184+
* `FieldPath`) and values with which to update the document.
185185
* @param completion A block to execute when the update is complete. If the update is successful the
186186
* error parameter will be nil, otherwise it will give an indication of how the update failed.
187187
* This block will only execute when the client is online and the commit has completed against
@@ -191,14 +191,15 @@ NS_SWIFT_NAME(DocumentReference)
191191
- (void)updateData:(NSDictionary<id, id> *)fields
192192
completion:(nullable void (^)(NSError *_Nullable error))completion;
193193

194-
// NOTE: this is named 'deleteDocument' because 'delete' is a keyword in Objective-C++.
195-
/** Deletes the document referred to by this `FIRDocumentReference`. */
194+
// NOTE: this method is named 'deleteDocument' in Objective-C because 'delete' is a keyword in
195+
// Objective-C++.
196+
/** Deletes the document referred to by this `DocumentReference`. */
196197
// clang-format off
197198
- (void)deleteDocument NS_SWIFT_NAME(delete());
198199
// clang-format on
199200

200201
/**
201-
* Deletes the document referred to by this `FIRDocumentReference`.
202+
* Deletes the document referred to by this `DocumentReference`.
202203
*
203204
* @param completion A block to execute once the document has been successfully written to the
204205
* server. This block will not be called while the client is offline, though local
@@ -212,7 +213,7 @@ NS_SWIFT_NAME(DocumentReference)
212213
#pragma mark - Retrieving Data
213214

214215
/**
215-
* Reads the document referenced by this `FIRDocumentReference`.
216+
* Reads the document referenced by this `DocumentReference`.
216217
*
217218
* This method attempts to provide up-to-date data when possible by waiting for
218219
* data from the server, but it may return cached data or fail if you are
@@ -225,7 +226,7 @@ NS_SWIFT_NAME(DocumentReference)
225226
NS_SWIFT_NAME(getDocument(completion:));
226227

227228
/**
228-
* Reads the document referenced by this `FIRDocumentReference`.
229+
* Reads the document referenced by this `DocumentReference`.
229230
*
230231
* @param source indicates whether the results should be fetched from the cache
231232
* only (`Source.cache`), the server only (`Source.server`), or to attempt
@@ -239,23 +240,23 @@ NS_SWIFT_NAME(DocumentReference)
239240
// clang-format on
240241

241242
/**
242-
* Attaches a listener for DocumentSnapshot events.
243+
* Attaches a listener for `DocumentSnapshot` events.
243244
*
244245
* @param listener The listener to attach.
245246
*
246-
* @return A FIRListenerRegistration that can be used to remove this listener.
247+
* @return A `ListenerRegistration` that can be used to remove this listener.
247248
*/
248249
- (id<FIRListenerRegistration>)addSnapshotListener:(FIRDocumentSnapshotBlock)listener
249250
NS_SWIFT_NAME(addSnapshotListener(_:));
250251

251252
/**
252-
* Attaches a listener for DocumentSnapshot events.
253+
* Attaches a listener for `DocumentSnapshot` events.
253254
*
254255
* @param includeMetadataChanges Whether metadata-only changes (i.e. only
255-
* `FIRDocumentSnapshot.metadata` changed) should trigger snapshot events.
256+
* `DocumentSnapshot.metadata` changed) should trigger snapshot events.
256257
* @param listener The listener to attach.
257258
*
258-
* @return A FIRListenerRegistration that can be used to remove this listener.
259+
* @return A `ListenerRegistration` that can be used to remove this listener.
259260
*/
260261
// clang-format off
261262
- (id<FIRListenerRegistration>)

0 commit comments

Comments
 (0)