@@ -92,7 +92,7 @@ Each Firebase framework should register with Core in the `+load` method of the c
92
92
` FIRLibrary ` . This needs to happen at ` +load ` time because Core needs to resolve any
93
93
dependencies before a class has a chance to be called by a developer (if called at all).
94
94
95
- ```
95
+ ``` obj-c
96
96
#import < FirebaseCore/FIRAppInternal.h>
97
97
#import < FirebaseCore/FIRComponentContainer.h>
98
98
#import < FirebaseCore/FIRLibrary.h>
@@ -106,8 +106,8 @@ dependencies before a class has a chance to be called by a developer (if called
106
106
// Register with Core as a library. The version should be fetched from a constant defined
107
107
// elsewhere, but that's not covered or relevant for this example.
108
108
[ FIRApp registerInternalLibrary: self
109
- withName:"fire-foo"
110
- withVersion:"1.0.0"];
109
+ withName:@ "fire-foo"
110
+ withVersion:@ "1.0.0"] ;
111
111
}
112
112
113
113
// TODO: Conform to ` FIRLibrary ` . See later sections for more information.
@@ -136,7 +136,7 @@ In this case, the framework is a "leaf node" since no other frameworks depend on
136
136
it. It has a private, empty protocol that it uses to register with the container. Using Functions as
137
137
an example:
138
138
139
- ```
139
+ ```obj-c
140
140
// FIRFunctions.m
141
141
142
142
/// Empty protocol to register Functions as a component with Core.
@@ -150,8 +150,8 @@ an example:
150
150
@implementation FIRFunctions
151
151
152
152
+ (void)load {
153
- NSString *version = <# Fetch the version here #>;
154
- [FIRApp registerInternalLibrary:self withName:"fire-fun" withVersion:version];
153
+ NSString *version = @" <# Fetch the version here #>" ;
154
+ [FIRApp registerInternalLibrary:self withName:@ "fire-fun" withVersion:version];
155
155
}
156
156
157
157
/// The array of components to register with Core. Since Functions is a leaf node and
@@ -201,7 +201,7 @@ an example:
201
201
This example will be very similar to the one above, but let's define a simple protocol that Auth
202
202
could conform to and provide to other frameworks:
203
203
204
- ```
204
+ ``` obj-c
205
205
// FIRAuthInterop.h in the FirebaseAuthInterop framework.
206
206
207
207
@protocol FIRAuthInterop
@@ -210,7 +210,7 @@ could conform to and provide to other frameworks:
210
210
@end
211
211
```
212
212
213
- ```
213
+ ```obj-c
214
214
// FIRAuth.m in the FirebaseAuth framework.
215
215
216
216
/// Privately conform to the protocol for interop and component registration.
@@ -219,8 +219,8 @@ could conform to and provide to other frameworks:
219
219
220
220
+ (void)load {
221
221
// Remember to register in +load!
222
- NSString *version = <# Fetch the version here #>;
223
- [FIRApp registerInternalLibrary:self withName:"fire-auth" withVersion:version];
222
+ NSString *version = @" <# Fetch the version here #>" ;
223
+ [FIRApp registerInternalLibrary:self withName:@ "fire-auth" withVersion:version];
224
224
}
225
225
226
226
/// The components to register with Core.
@@ -251,7 +251,7 @@ Instead of directly providing an instance from the container, Firestore and simi
251
251
create a "provider" that stores and creates instances with the required parameters. This means a
252
252
single provider per ` FIRApp ` , but multiple instances are possible per provider.
253
253
254
- ```
254
+ ``` obj-c
255
255
// / Provider protocol to register with Core.
256
256
@protocol FSTFirestoreMultiDBProvider
257
257
@@ -269,7 +269,7 @@ single provider per `FIRApp`, but multiple instances are possible per provider.
269
269
Instead of the Firestore class conforming to `FSTInstanceProvider`, the work can be done in a
270
270
separate class to keep `Firestore.m` cleaner.
271
271
272
- ```
272
+ ```obj-c
273
273
/// A concrete implementation for FSTFirestoreMultiDBProvider to create Firestore instances.
274
274
@interface FSTFirestoreComponent : NSObject <FSTFirestoreMultiDBProvider, FIRLibrary>
275
275
@@ -294,8 +294,8 @@ separate class to keep `Firestore.m` cleaner.
294
294
295
295
+ (void)load {
296
296
// Remember to register in +load!
297
- NSString *version = <# Fetch the version here #>;
298
- [FIRApp registerInternalLibrary:self withName:"fire-fst" withVersion:version];
297
+ NSString *version = @" <# Fetch the version here #>" ;
298
+ [FIRApp registerInternalLibrary:self withName:@ "fire-fst" withVersion:version];
299
299
}
300
300
301
301
- (instancetype)initWithApp:(FIRApp *)app {
@@ -334,7 +334,7 @@ separate class to keep `Firestore.m` cleaner.
334
334
335
335
All ` Firestore.m ` needs to do now is call the component container from the singleton calls:
336
336
337
- ```
337
+ ``` obj-c
338
338
+ (instancetype )firestoreForApp:(FIRApp *)app database:(NSString *)database {
339
339
id<FSTFirestoreMultiDBProvider > provider =
340
340
FIR_COMPONENT(FSTFirestoreMultiDBProvider, app.container);
@@ -355,7 +355,7 @@ Functions above and add a dependency to `FIRAuthInterop` defined above.
355
355
356
356
Before adding the dependency on ` FIRAuthInterop ` .
357
357
358
- ```
358
+ ``` obj-c
359
359
+ (NSArray <FIRComponent *> *)componentsToRegister {
360
360
FIRComponentCreationBlock creationBlock =
361
361
^id _ Nullable(FIRComponentContainer * container, BOOL * isCacheable) {
@@ -373,7 +373,7 @@ Before adding the dependency on `FIRAuthInterop`.
373
373
374
374
After adding the dependency on ` FIRAuthInterop ` . See comments with "ADDED:".
375
375
376
- ```
376
+ ``` obj-c
377
377
+ (NSArray <FIRComponent *> *)componentsToRegister {
378
378
FIRComponentCreationBlock creationBlock =
379
379
^id _ Nullable(FIRComponentContainer * container, BOOL * isCacheable) {
@@ -413,7 +413,7 @@ After adding the dependency on `FIRAuthInterop`. See comments with "ADDED:".
413
413
Based on the new constructor, Functions can now use the ` auth ` instance as defined by the
414
414
protocol:
415
415
416
- ```
416
+ ``` obj-c
417
417
NSString *userID = [auth getUserID ];
418
418
if (userID) {
419
419
// Auth is available and a user is signed in!
@@ -434,7 +434,7 @@ In order to alleviate this, Auth could create a third private protocol
434
434
becomes a dependency for each of those two components and returned in the component creation block.
435
435
An abbreviated code sample:
436
436
437
- ```
437
+ ``` obj-c
438
438
439
439
+ (NSArray <FIRComponent *> *)componentsToRegister {
440
440
// Standard creation block to get an instance of Auth.
0 commit comments