Skip to content

Commit 274ae6c

Browse files
authored
Merge pull request #4 from firebase/getinstance
Add snippet for getting Firestore instance in cpp
2 parents d0b87c5 + 54b585e commit 274ae6c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

‎.github/workflows/firestore-ios.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: macOS-latest
1616
strategy:
1717
matrix:
18-
destination: ['platform=iOS Simulator,OS=13.5,name=iPhone 11']
18+
destination: ['platform=iOS Simulator,OS=latest,name=iPhone 11']
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@master

‎firestore/ios/firestore-snippets-cpp/AppDelegate.mm

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,25 @@
1717
#import "AppDelegate.h"
1818
#import <Firebase/Firebase.h>
1919
#include "firebase/app.h"
20+
#include "firebase/firestore.h"
21+
22+
using firebase::App;
23+
using firebase::firestore::Firestore;
2024

2125
@interface AppDelegate ()
2226

2327
@end
2428

2529
@implementation AppDelegate
2630

27-
2831
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
2932
[FIRApp configure];
30-
firebase::App::Create();
33+
// [START get_firestore_instance]
34+
// Make sure the call to `Create()` happens some time before you call Firestore::GetInstance().
35+
App::Create();
36+
Firestore* db = Firestore::GetInstance();
37+
// [END get_firestore_instance]
38+
(void)db; // suppress unused variable warning
3139
return YES;
3240
}
3341

0 commit comments

Comments
 (0)