diff options
author | Sebastian Schmidt <mrschmidt@google.com> | 2017-12-10 14:40:22 -0800 |
---|---|---|
committer | Sebastian Schmidt <mrschmidt@google.com> | 2017-12-10 14:40:22 -0800 |
commit | bc179ea4ea7edff419a40d4fed423123f9f08a2b (patch) | |
tree | 764a0eee347c1c2f195615b3e0de0d0061b3e5bf /Firestore/Source/Public/FIRDocumentSnapshot.h | |
parent | 91f26774b45192f3c7b4302a7d9f69fc2e904eee (diff) |
Making DocumentSnapshot nullable
Diffstat (limited to 'Firestore/Source/Public/FIRDocumentSnapshot.h')
-rw-r--r-- | Firestore/Source/Public/FIRDocumentSnapshot.h | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/Firestore/Source/Public/FIRDocumentSnapshot.h b/Firestore/Source/Public/FIRDocumentSnapshot.h index 3e67c25..9706edd 100644 --- a/Firestore/Source/Public/FIRDocumentSnapshot.h +++ b/Firestore/Source/Public/FIRDocumentSnapshot.h @@ -46,21 +46,44 @@ NS_SWIFT_NAME(DocumentSnapshot) @property(nonatomic, strong, readonly) FIRSnapshotMetadata *metadata; /** - * Retrieves all fields in the document as an `NSDictionary`. + * Retrieves all fields in the document as an `NSDictionary`. Returns `nil` if the document doesn't + * exist. * - * @return An `NSDictionary` containing all fields in the document. + * @return An `NSDictionary` containing all fields in the document or `nil` if the document doesn't + * exist. */ -- (NSDictionary<NSString *, id> *)data; +- (nullable NSDictionary<NSString *, id> *)data; /** * Retrieves a specific field from the document. * * @param key The field to retrieve. * - * @return The value contained in the field or `nil` if the field doesn't exist. + * @return The value contained in the field or `nil` if the document or field doesn't exist. */ - (nullable id)objectForKeyedSubscript:(id)key; @end +/** + * A `FIRDocumentSnapshot` contains data read from a document in your Firestore database. The + * document is guaranteed to exist and its data can be extracted with the `data` property or by using + * subscript syntax to access a specific field. + */ +NS_SWIFT_NAME(QueryDocumentSnapshot) +@interface FIRQueryDocumentSnapshot : FIRDocumentSnapshot + +/** */ +- (instancetype)init + __attribute__((unavailable("FIRQueryDocumentSnapshot cannot be created directly."))); + +/** + * Retrieves all fields in the document as an `NSDictionary`. + * + * @return An `NSDictionary` containing all fields in the document. + */ +- (NSDictionary<NSString *, id> *)data; + +@end + NS_ASSUME_NONNULL_END |