File tree 5 files changed +23
-46
lines changed
FirestoreCodableSamples/Screens
FirestoreCodableSamples.xcodeproj
5 files changed +23
-46
lines changed Original file line number Diff line number Diff line change 60
60
887A4A7F2608EA7E009ACBB1 /* MappingEnumsScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MappingEnumsScreen.swift; sourceTree = "<group>"; };
61
61
887DD2B325C47A23003F7A99 /* Book.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Book.swift; sourceTree = "<group>"; };
62
62
888F881325C46A9C00DCE039 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
63
+ 88BBF4452790B29800A6D1A7 /* firebase-ios-sdk */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "firebase-ios-sdk"; path = "../../../Projects/Incubation/Firebase/firebase-documentsnapshot-typing/firebase-ios-sdk"; sourceTree = "<group>"; };
63
64
/* End PBXFileReference section */
64
65
65
66
/* Begin PBXFrameworksBuildPhase section */
78
79
8845BD6D25C46965002AEC45 = {
79
80
isa = PBXGroup;
80
81
children = (
82
+ 88BBF4442790B29800A6D1A7 /* Packages */,
81
83
8845BD7825C46965002AEC45 /* FirestoreCodableSamples */,
82
84
8845BD7725C46965002AEC45 /* Products */,
83
85
887DD2AD25C479FD003F7A99 /* Frameworks */,
178
180
path = ViewModels;
179
181
sourceTree = "<group>";
180
182
};
183
+ 88BBF4442790B29800A6D1A7 /* Packages */ = {
184
+ isa = PBXGroup;
185
+ children = (
186
+ 88BBF4452790B29800A6D1A7 /* firebase-ios-sdk */,
187
+ );
188
+ name = Packages;
189
+ sourceTree = "<group>";
190
+ };
181
191
/* End PBXGroup section */
182
192
183
193
/* Begin PBXNativeTarget section */
Original file line number Diff line number Diff line change @@ -38,17 +38,9 @@ class CustomizeMappingViewModel: ObservableObject {
38
38
39
39
switch result {
40
40
case . success( let programmingLanguage) :
41
- if let programmingLanguage = programmingLanguage {
42
- // A ProgrammingLanguage value was successfully initialized from the DocumentSnapshot.
43
- self ? . errorMessage = nil
44
- return programmingLanguage
45
- }
46
- else {
47
- // A nil value was successfully initialized from the DocumentSnapshot,
48
- // or the DocumentSnapshot was nil.
49
- self ? . errorMessage = " Document doesn't exist. "
50
- return nil
51
- }
41
+ // A ProgrammingLanguage value was successfully initialized from the DocumentSnapshot.
42
+ self ? . errorMessage = nil
43
+ return programmingLanguage
52
44
case . failure( let error) :
53
45
// A Book value could not be initialized from the DocumentSnapshot.
54
46
switch error {
Original file line number Diff line number Diff line change @@ -35,22 +35,13 @@ class MappingColorsViewModel: ObservableObject {
35
35
36
36
self ? . colorEntries = documents. compactMap { queryDocumentSnapshot in
37
37
let result = Result { try queryDocumentSnapshot. data ( as: ColorEntry . self) }
38
-
39
38
switch result {
40
39
case . success( let colorEntry) :
41
- if let colorEntry = colorEntry {
42
- // A ColorEntry value was successfully initialized from the DocumentSnapshot.
43
- self ? . errorMessage = nil
44
- return colorEntry
45
- }
46
- else {
47
- // A nil value was successfully initialized from the DocumentSnapshot,
48
- // or the DocumentSnapshot was nil.
49
- self ? . errorMessage = " Document doesn't exist. "
50
- return nil
51
- }
40
+ // A ColorEntry value was successfully initialized from the DocumentSnapshot.
41
+ self ? . errorMessage = nil
42
+ return colorEntry
52
43
case . failure( let error) :
53
- // A Book value could not be initialized from the DocumentSnapshot.
44
+ // A ColorEntry value could not be initialized from the DocumentSnapshot.
54
45
switch error {
55
46
case DecodingError . typeMismatch( _, let context) :
56
47
self ? . errorMessage = " \( error. localizedDescription) : \( context. debugDescription) "
Original file line number Diff line number Diff line change @@ -76,17 +76,9 @@ class MappingEnumsViewModel: ObservableObject {
76
76
77
77
switch result {
78
78
case . success( let article) :
79
- if let article = article {
80
- // An Article value was successfully initialized from the DocumentSnapshot.
81
- self ? . errorMessage = nil
82
- return article
83
- }
84
- else {
85
- // A nil value was successfully initialized from the DocumentSnapshot,
86
- // or the DocumentSnapshot was nil.
87
- self ? . errorMessage = " Document doesn't exist. "
88
- return nil
89
- }
79
+ // An Article value was successfully initialized from the DocumentSnapshot.
80
+ self ? . errorMessage = nil
81
+ return article
90
82
case . failure( let error) :
91
83
// An Article value could not be initialized from the DocumentSnapshot.
92
84
switch error {
Original file line number Diff line number Diff line change @@ -82,17 +82,9 @@ class MappingGeoPointsViewModel: ObservableObject {
82
82
83
83
switch result {
84
84
case . success( let office) :
85
- if let office = office {
86
- // An Office value was successfully initialized from the DocumentSnapshot.
87
- self ? . errorMessage = nil
88
- return office
89
- }
90
- else {
91
- // A nil value was successfully initialized from the DocumentSnapshot,
92
- // or the DocumentSnapshot was nil.
93
- self ? . errorMessage = " Document doesn't exist. "
94
- return nil
95
- }
85
+ // An Office value was successfully initialized from the DocumentSnapshot.
86
+ self ? . errorMessage = nil
87
+ return office
96
88
case . failure( let error) :
97
89
// An Office value could not be initialized from the DocumentSnapshot.
98
90
switch error {
You can’t perform that action at this time.
0 commit comments