Skip to content

Commit a5859f9

Browse files
peterfriesechFlorianmortenbekditlevsen
authored
Add property wrapper for Firestore (#8614)
* Add FIRRequest * Make FIRPredicate public * Make init public * Bugfixes * Add debug print * Move to main thread * Undo "Move to main thread" * Add FirebaseStore * Add placeholder value * Treat CollectionReference as Query * Change let to var * Replace getDocuments with addSnapshotListener * Feedback from review * Add sample project * Rename folder, Rename FirebaseStore to QueryStore, Rename FIRRequest to FirestoreQuery, Rename several functions, attributes and parameter labels, Extend error handling * Update some access specifiers, Add factory methods * Add orderBy and limitTo * Update Copyright, Rename FIRPredicate to QueryPredicate, Rename QueryStore to FirestoreQueryObservable, Rename some parameters, Remove setter for wrappedValue * Rename store to firestoreQueryObservable * Add limitToLast * Move different types to different files * Add FirestoreQueryConfiguration and projectedValue to dynamically change predicates & collectionPath * Add Documentation * Update documentation * Add example app * Address feedback from review * Fix whitespace * Address feedback from review * Update data * Add error handling (Manually cherry pick from Morten's PR: https://github.com/chFlorian/firebase-ios-sdk/pull/2) * Update sample app to demonstrate error handling * Cleanup * Fix warning regarding unwrapping * Fix tvOS availability * Fix typos * Experimental: use @FirestoreQuery inside a view model (Hint: this doesn't work) * Fix platform availabilities * Update data * Improve error handling * Cleanup * Address feedback from review * Update data * Cleanup * Alternate signature for predicates * Address feedback from review * Remove trailing backtick Co-authored-by: Florian Schweizer <[email protected]> Co-authored-by: Morten Bek Ditlevsen <[email protected]>
1 parent c7c0149 commit a5859f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1610
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,8 @@ FirebaseInAppMessaging/Tests/Integration/FunctionalTestApp/App/InAppMessaging-Ex
151151
# FIRAppCheckTestApp
152152
FirebaseAppCheck/Apps/FIRAppCheckTestApp/FIRAppCheckTestApp/GoogleService-Info.plist
153153
FirebaseAppCheck/Apps/AppCheckCustomProvideApp/AppCheckCustomProvideApp/GoogleService-Info.plist
154+
155+
# FirestoreSample
156+
/Example/FirestoreSample/FirestoreSample/GoogleService-Info.plist
157+
/Example/FirestoreSample/ui-debug.log
158+
/Example/FirestoreSample/firestore-debug.log

Example/FirestoreSample/.firebaserc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

Example/FirestoreSample/FirestoreSample.xcodeproj/project.pbxproj

Lines changed: 417 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import SwiftUI
16+
import Firebase
17+
18+
@main
19+
struct FirestoreSampleApp: App {
20+
init() {
21+
FirebaseApp.configure()
22+
23+
let settings = Firestore.firestore().settings
24+
settings.host = "localhost:8080"
25+
settings.isPersistenceEnabled = false
26+
settings.isSSLEnabled = false
27+
Firestore.firestore().settings = settings
28+
}
29+
30+
var body: some Scene {
31+
WindowGroup {
32+
NavigationView {
33+
MenuView()
34+
}
35+
// see https://stackoverflow.com/q/63740788/
36+
.navigationViewStyle(StackNavigationViewStyle())
37+
}
38+
}
39+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"colors" : [
3+
{
4+
"color" : {
5+
"color-space" : "srgb",
6+
"components" : {
7+
"alpha" : "1.000",
8+
"blue" : "0.157",
9+
"green" : "0.792",
10+
"red" : "1.000"
11+
}
12+
},
13+
"idiom" : "universal"
14+
}
15+
],
16+
"info" : {
17+
"author" : "xcode",
18+
"version" : 1
19+
}
20+
}
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "40.png",
5+
"idiom" : "iphone",
6+
"scale" : "2x",
7+
"size" : "20x20"
8+
},
9+
{
10+
"filename" : "60.png",
11+
"idiom" : "iphone",
12+
"scale" : "3x",
13+
"size" : "20x20"
14+
},
15+
{
16+
"filename" : "29.png",
17+
"idiom" : "iphone",
18+
"scale" : "1x",
19+
"size" : "29x29"
20+
},
21+
{
22+
"filename" : "58.png",
23+
"idiom" : "iphone",
24+
"scale" : "2x",
25+
"size" : "29x29"
26+
},
27+
{
28+
"filename" : "87.png",
29+
"idiom" : "iphone",
30+
"scale" : "3x",
31+
"size" : "29x29"
32+
},
33+
{
34+
"filename" : "80.png",
35+
"idiom" : "iphone",
36+
"scale" : "2x",
37+
"size" : "40x40"
38+
},
39+
{
40+
"filename" : "120.png",
41+
"idiom" : "iphone",
42+
"scale" : "3x",
43+
"size" : "40x40"
44+
},
45+
{
46+
"filename" : "57.png",
47+
"idiom" : "iphone",
48+
"scale" : "1x",
49+
"size" : "57x57"
50+
},
51+
{
52+
"filename" : "114.png",
53+
"idiom" : "iphone",
54+
"scale" : "2x",
55+
"size" : "57x57"
56+
},
57+
{
58+
"filename" : "120.png",
59+
"idiom" : "iphone",
60+
"scale" : "2x",
61+
"size" : "60x60"
62+
},
63+
{
64+
"filename" : "180.png",
65+
"idiom" : "iphone",
66+
"scale" : "3x",
67+
"size" : "60x60"
68+
},
69+
{
70+
"filename" : "20.png",
71+
"idiom" : "ipad",
72+
"scale" : "1x",
73+
"size" : "20x20"
74+
},
75+
{
76+
"filename" : "40.png",
77+
"idiom" : "ipad",
78+
"scale" : "2x",
79+
"size" : "20x20"
80+
},
81+
{
82+
"filename" : "29.png",
83+
"idiom" : "ipad",
84+
"scale" : "1x",
85+
"size" : "29x29"
86+
},
87+
{
88+
"filename" : "58.png",
89+
"idiom" : "ipad",
90+
"scale" : "2x",
91+
"size" : "29x29"
92+
},
93+
{
94+
"filename" : "40.png",
95+
"idiom" : "ipad",
96+
"scale" : "1x",
97+
"size" : "40x40"
98+
},
99+
{
100+
"filename" : "80.png",
101+
"idiom" : "ipad",
102+
"scale" : "2x",
103+
"size" : "40x40"
104+
},
105+
{
106+
"filename" : "50.png",
107+
"idiom" : "ipad",
108+
"scale" : "1x",
109+
"size" : "50x50"
110+
},
111+
{
112+
"filename" : "100.png",
113+
"idiom" : "ipad",
114+
"scale" : "2x",
115+
"size" : "50x50"
116+
},
117+
{
118+
"filename" : "72.png",
119+
"idiom" : "ipad",
120+
"scale" : "1x",
121+
"size" : "72x72"
122+
},
123+
{
124+
"filename" : "144.png",
125+
"idiom" : "ipad",
126+
"scale" : "2x",
127+
"size" : "72x72"
128+
},
129+
{
130+
"filename" : "76.png",
131+
"idiom" : "ipad",
132+
"scale" : "1x",
133+
"size" : "76x76"
134+
},
135+
{
136+
"filename" : "152.png",
137+
"idiom" : "ipad",
138+
"scale" : "2x",
139+
"size" : "76x76"
140+
},
141+
{
142+
"filename" : "167.png",
143+
"idiom" : "ipad",
144+
"scale" : "2x",
145+
"size" : "83.5x83.5"
146+
},
147+
{
148+
"filename" : "1024.png",
149+
"idiom" : "ios-marketing",
150+
"scale" : "1x",
151+
"size" : "1024x1024"
152+
},
153+
{
154+
"filename" : "48.png",
155+
"idiom" : "watch",
156+
"role" : "notificationCenter",
157+
"scale" : "2x",
158+
"size" : "24x24",
159+
"subtype" : "38mm"
160+
},
161+
{
162+
"filename" : "55.png",
163+
"idiom" : "watch",
164+
"role" : "notificationCenter",
165+
"scale" : "2x",
166+
"size" : "27.5x27.5",
167+
"subtype" : "42mm"
168+
},
169+
{
170+
"filename" : "58.png",
171+
"idiom" : "watch",
172+
"role" : "companionSettings",
173+
"scale" : "2x",
174+
"size" : "29x29"
175+
},
176+
{
177+
"filename" : "87.png",
178+
"idiom" : "watch",
179+
"role" : "companionSettings",
180+
"scale" : "3x",
181+
"size" : "29x29"
182+
},
183+
{
184+
"filename" : "80.png",
185+
"idiom" : "watch",
186+
"role" : "appLauncher",
187+
"scale" : "2x",
188+
"size" : "40x40",
189+
"subtype" : "38mm"
190+
},
191+
{
192+
"filename" : "88.png",
193+
"idiom" : "watch",
194+
"role" : "appLauncher",
195+
"scale" : "2x",
196+
"size" : "44x44",
197+
"subtype" : "40mm"
198+
},
199+
{
200+
"filename" : "100.png",
201+
"idiom" : "watch",
202+
"role" : "appLauncher",
203+
"scale" : "2x",
204+
"size" : "50x50",
205+
"subtype" : "44mm"
206+
},
207+
{
208+
"filename" : "172.png",
209+
"idiom" : "watch",
210+
"role" : "quickLook",
211+
"scale" : "2x",
212+
"size" : "86x86",
213+
"subtype" : "38mm"
214+
},
215+
{
216+
"filename" : "196.png",
217+
"idiom" : "watch",
218+
"role" : "quickLook",
219+
"scale" : "2x",
220+
"size" : "98x98",
221+
"subtype" : "42mm"
222+
},
223+
{
224+
"filename" : "216.png",
225+
"idiom" : "watch",
226+
"role" : "quickLook",
227+
"scale" : "2x",
228+
"size" : "108x108",
229+
"subtype" : "44mm"
230+
},
231+
{
232+
"filename" : "1024.png",
233+
"idiom" : "watch-marketing",
234+
"scale" : "1x",
235+
"size" : "1024x1024"
236+
},
237+
{
238+
"filename" : "16.png",
239+
"idiom" : "mac",
240+
"scale" : "1x",
241+
"size" : "16x16"
242+
},
243+
{
244+
"filename" : "32.png",
245+
"idiom" : "mac",
246+
"scale" : "2x",
247+
"size" : "16x16"
248+
},
249+
{
250+
"filename" : "32.png",
251+
"idiom" : "mac",
252+
"scale" : "1x",
253+
"size" : "32x32"
254+
},
255+
{
256+
"filename" : "64.png",
257+
"idiom" : "mac",
258+
"scale" : "2x",
259+
"size" : "32x32"
260+
},
261+
{
262+
"filename" : "128.png",
263+
"idiom" : "mac",
264+
"scale" : "1x",
265+
"size" : "128x128"
266+
},
267+
{
268+
"filename" : "256.png",
269+
"idiom" : "mac",
270+
"scale" : "2x",
271+
"size" : "128x128"
272+
},
273+
{
274+
"filename" : "256.png",
275+
"idiom" : "mac",
276+
"scale" : "1x",
277+
"size" : "256x256"
278+
},
279+
{
280+
"filename" : "512.png",
281+
"idiom" : "mac",
282+
"scale" : "2x",
283+
"size" : "256x256"
284+
},
285+
{
286+
"filename" : "512.png",
287+
"idiom" : "mac",
288+
"scale" : "1x",
289+
"size" : "512x512"
290+
},
291+
{
292+
"filename" : "1024.png",
293+
"idiom" : "mac",
294+
"scale" : "2x",
295+
"size" : "512x512"
296+
}
297+
],
298+
"info" : {
299+
"author" : "xcode",
300+
"version" : 1
301+
}
302+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}

0 commit comments

Comments
 (0)