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 <post.an.flo@gmail.com> Co-authored-by: Morten Bek Ditlevsen <bek@termestrup.dk>
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
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+
}
5.33 KB
Loading
97.5 KB
Loading
6.38 KB
Loading
6.67 KB
Loading
7.31 KB
Loading

0 commit comments

Comments
 (0)