Skip to content

Commit 9167afc

Browse files
committed
rename firebase database classes to use objc prefix convention
1 parent e6e92da commit 9167afc

16 files changed

+179
-199
lines changed

FirebaseDatabaseUI/FirebaseArray.h renamed to FirebaseDatabaseUI/FUIArray.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
@import FirebaseDatabase;
2222

23-
#import "FirebaseArrayDelegate.h"
23+
#import "FUIArrayDelegate.h"
2424

2525
NS_ASSUME_NONNULL_BEGIN
2626

@@ -43,13 +43,13 @@ NS_ASSUME_NONNULL_BEGIN
4343
* query. It is useful for building custom data structures or sources, and provides the base for
4444
* FirebaseDataSource.
4545
*/
46-
@interface FirebaseArray : NSObject
46+
@interface FUIArray : NSObject
4747

4848
/**
4949
* The delegate object that array changes are surfaced to, which conforms to the
50-
* @c FirebaseArrayDelegate protocol.
50+
* @c FUIArrayDelegate protocol.
5151
*/
52-
@property(weak, nonatomic, nullable) id<FirebaseArrayDelegate> delegate;
52+
@property(weak, nonatomic, nullable) id<FUIArrayDelegate> delegate;
5353

5454
/**
5555
* The query on a Firebase reference that provides data to populate the instance of FirebaseArray.

FirebaseDatabaseUI/FirebaseArray.m renamed to FirebaseDatabaseUI/FUIArray.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
// clang-format on
2020

21-
#import "FirebaseArray.h"
21+
#import "FUIArray.h"
2222

23-
@interface FirebaseArray ()
23+
@interface FUIArray ()
2424

2525
/**
2626
* The backing collection that holds all of the FirebaseArray's data.
@@ -35,7 +35,7 @@ @interface FirebaseArray ()
3535

3636
@end
3737

38-
@implementation FirebaseArray
38+
@implementation FUIArray
3939

4040
#pragma mark - Initializer methods
4141

@@ -178,8 +178,8 @@ - (id)objectAtIndexedSubscript:(NSUInteger)index {
178178
}
179179

180180
- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)index{
181-
@throw [NSException exceptionWithName:@"FirebaseArraySetIndexWithSubscript"
182-
reason:@"Setting an object as FirebaseArray[i] is not supported."
181+
@throw [NSException exceptionWithName:@"FUIArraySetIndexWithSubscript"
182+
reason:@"Setting an object as FUIArray[i] is not supported."
183183
userInfo:nil];
184184
}
185185

FirebaseDatabaseUI/FirebaseArrayDelegate.h renamed to FirebaseDatabaseUI/FUIArrayDelegate.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818

1919
// clang-format on
2020

21-
@class FirebaseArray;
21+
@class FUIArray;
2222

2323
/**
2424
* A protocol to allow instances of FirebaseArray to raise events through a
2525
* delegate. Raises all
2626
* Firebase events except FIRDataEventTypeValue.
2727
*/
28-
@protocol FirebaseArrayDelegate<NSObject>
28+
@protocol FUIArrayDelegate<NSObject>
2929

3030
@optional
3131

@@ -38,7 +38,7 @@
3838
* @param object The object added to the FirebaseArray
3939
* @param index The index the child was added at
4040
*/
41-
- (void)array:(FirebaseArray *)array didAddObject:(id)object atIndex:(NSUInteger)index;
41+
- (void)array:(FUIArray *)array didAddObject:(id)object atIndex:(NSUInteger)index;
4242

4343
/**
4444
* Delegate method which is called whenever an object is chinged in a
@@ -49,7 +49,7 @@
4949
* @param object The object that changed in the FirebaseArray
5050
* @param index The index the child was changed at
5151
*/
52-
- (void)array:(FirebaseArray *)array didChangeObject:(id)object atIndex:(NSUInteger)index;
52+
- (void)array:(FUIArray *)array didChangeObject:(id)object atIndex:(NSUInteger)index;
5353

5454
/**
5555
* Delegate method which is called whenever an object is removed from a
@@ -60,7 +60,7 @@
6060
* @param object The object removed from the FirebaseArray
6161
* @param index The index the child was removed at
6262
*/
63-
- (void)array:(FirebaseArray *)array didRemoveObject:(id)object atIndex:(NSUInteger)index;
63+
- (void)array:(FUIArray *)array didRemoveObject:(id)object atIndex:(NSUInteger)index;
6464

6565
/**
6666
* Delegate method which is called whenever an object is moved within a
@@ -72,12 +72,12 @@
7272
* @param fromIndex The index the child is being moved from
7373
* @param toIndex The index the child is being moved to
7474
*/
75-
- (void)array:(FirebaseArray *)array didMoveObject:(id)object fromIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex;
75+
- (void)array:(FUIArray *)array didMoveObject:(id)object fromIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex;
7676

7777
/**
7878
* Delegate method which is called whenever the backing query is canceled.
7979
* @param error the error that was raised
8080
*/
81-
- (void)array:(FirebaseArray *)array queryCancelledWithError:(NSError *)error;
81+
- (void)array:(FUIArray *)array queryCancelledWithError:(NSError *)error;
8282

8383
@end

FirebaseDatabaseUI/FirebaseCollectionViewDataSource.h renamed to FirebaseDatabaseUI/FUICollectionViewDataSource.h

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,19 @@
2020

2121
@import UIKit;
2222

23-
#import "FirebaseDataSource.h"
23+
#import "FUIDataSource.h"
2424

2525
NS_ASSUME_NONNULL_BEGIN
2626

2727
@class FIRDatabaseReference;
2828

2929
/**
30-
* FirebaseCollectionViewDataSource provides an class that conforms to the
31-
* UICollcetionViewDataSource protocol which allows UICollectionViews to
32-
* implement
33-
* FirebaseCollectionViewDataSource in order to provide a UICollectionView
34-
* synchronized to a
35-
* Firebase reference or query. In addition to handling all Firebase child
36-
* events (added, changed,
37-
* removed, moved), FirebaseCollectionViewDataSource handles UITableViewCell
38-
* creation, either with
39-
* the default UICollectionViewCell, prototype cells, custom
40-
* UICollectionViewCell subclasses, or
41-
* custom XIBs, and provides a simple [FirebaseCollectionViewDataSource
42-
* populateCellWithBlock:]
43-
* method which allows developers to populate the cells created for them with
44-
* desired data from
45-
* Firebase.
30+
* FUICollectionViewDataSource provides a class that conforms to the
31+
* UICollectionViewDataSource protocol which allows UICollectionViews to
32+
* adopt FUICollectionViewDataSource in order to provide a UICollectionView
33+
* synchronized to a Firebase reference or query.
4634
*/
47-
@interface FirebaseCollectionViewDataSource : FirebaseDataSource<UICollectionViewDataSource>
35+
@interface FUICollectionViewDataSource : FUIDataSource<UICollectionViewDataSource>
4836

4937
/**
5038
* The UICollectionView instance that operations (inserts, removals, moves,
@@ -61,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
6149
(UICollectionView *collectionView, NSIndexPath *indexPath, FIRDataSnapshot *object);
6250

6351
/**
64-
* Initialize an instance of FirebaseCollectionViewDataSource that populates
52+
* Initialize an instance of FUICollectionViewDataSource that populates
6553
* UICollectionViewCells with FIRDataSnapshots.
6654
* @param query A Firebase query to bind the data source to.
6755
* @param collectionView An instance of a UICollectionView to bind to. This view
@@ -70,7 +58,7 @@ NS_ASSUME_NONNULL_BEGIN
7058
* are displayed in the collection view. This closure is retained by the data
7159
* source, so if you capture self in the closure and also claim ownership of the
7260
* data source, be sure to avoid retain cycles by capturing a weak reference to self.
73-
* @return An instance of FirebaseCollectionViewDataSource that populates
61+
* @return An instance of FUICollectionViewDataSource that populates
7462
* UICollectionViewCells with FIRDataSnapshots.
7563
*/
7664
- (instancetype)initWithQuery:(FIRDatabaseQuery *)query
@@ -79,11 +67,11 @@ NS_ASSUME_NONNULL_BEGIN
7967
NSIndexPath *indexPath,
8068
FIRDataSnapshot *object))populateCell NS_DESIGNATED_INITIALIZER;
8169

82-
- (instancetype)initWithArray:(FirebaseArray *)array NS_UNAVAILABLE;
70+
- (instancetype)initWithArray:(FUIArray *)array NS_UNAVAILABLE;
8371

8472
@end
8573

86-
@interface UICollectionView (FirebaseCollectionViewDataSource)
74+
@interface UICollectionView (FUICollectionViewDataSource)
8775

8876
/**
8977
* Creates a data source, attaches it to the collection view, and returns it.
@@ -96,7 +84,7 @@ NS_ASSUME_NONNULL_BEGIN
9684
* @return The created data source. This value must be retained while the collection
9785
* view is in use.
9886
*/
99-
- (FirebaseCollectionViewDataSource *)bindToQuery:(FIRDatabaseQuery *)query
87+
- (FUICollectionViewDataSource *)bindToQuery:(FIRDatabaseQuery *)query
10088
populateCell:(UICollectionViewCell *(^)(UICollectionView *collectionView,
10189
NSIndexPath *indexPath,
10290
FIRDataSnapshot *object))populateCell __attribute__((warn_unused_result));

FirebaseDatabaseUI/FirebaseCollectionViewDataSource.m renamed to FirebaseDatabaseUI/FUICollectionViewDataSource.m

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@
1818

1919
// clang-format on
2020

21-
#import "FirebaseCollectionViewDataSource.h"
21+
#import "FUICollectionViewDataSource.h"
2222

2323
@import FirebaseDatabase;
2424

25-
@implementation FirebaseCollectionViewDataSource
25+
@implementation FUICollectionViewDataSource
2626

27-
#pragma mark - FirebaseDataSource initializer methods
27+
#pragma mark - FUIDataSource initializer methods
2828

2929
- (instancetype)initWithQuery:(FIRDatabaseQuery *)query
3030
view:(UICollectionView *)collectionView
3131
populateCell:(UICollectionViewCell *(^)(UICollectionView *,
3232
NSIndexPath *,
3333
FIRDataSnapshot *))populateCell {
34-
FirebaseArray *array = [[FirebaseArray alloc] initWithQuery:query];
34+
FUIArray *array = [[FUIArray alloc] initWithQuery:query];
3535
self = [super initWithArray:array];
3636
if (self) {
3737
_collectionView = collectionView;
@@ -40,24 +40,24 @@ - (instancetype)initWithQuery:(FIRDatabaseQuery *)query
4040
return self;
4141
}
4242

43-
#pragma mark - FirebaseArrayDelegate methods
43+
#pragma mark - FUIArrayDelegate methods
4444

45-
- (void)array:(FirebaseArray *)array didAddObject:(id)object atIndex:(NSUInteger)index {
45+
- (void)array:(FUIArray *)array didAddObject:(id)object atIndex:(NSUInteger)index {
4646
[self.collectionView
4747
insertItemsAtIndexPaths:@[ [NSIndexPath indexPathForItem:index inSection:0] ]];
4848
}
4949

50-
- (void)array:(FirebaseArray *)array didChangeObject:(id)object atIndex:(NSUInteger)index {
50+
- (void)array:(FUIArray *)array didChangeObject:(id)object atIndex:(NSUInteger)index {
5151
[self.collectionView
5252
reloadItemsAtIndexPaths:@[ [NSIndexPath indexPathForItem:index inSection:0] ]];
5353
}
5454

55-
- (void)array:(FirebaseArray *)array didRemoveObject:(id)object atIndex:(NSUInteger)index {
55+
- (void)array:(FUIArray *)array didRemoveObject:(id)object atIndex:(NSUInteger)index {
5656
[self.collectionView
5757
deleteItemsAtIndexPaths:@[ [NSIndexPath indexPathForItem:index inSection:0] ]];
5858
}
5959

60-
- (void)array:(FirebaseArray *)array didMoveObject:(id)object
60+
- (void)array:(FUIArray *)array didMoveObject:(id)object
6161
fromIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex {
6262
[self.collectionView moveItemAtIndexPath:[NSIndexPath indexPathForItem:fromIndex inSection:0]
6363
toIndexPath:[NSIndexPath indexPathForItem:toIndex inSection:0]];
@@ -85,14 +85,14 @@ - (NSInteger)collectionView:(nonnull UICollectionView *)collectionView
8585

8686
@end
8787

88-
@implementation UICollectionView (FirebaseCollectionViewDataSource)
88+
@implementation UICollectionView (FUICollectionViewDataSource)
8989

90-
- (FirebaseCollectionViewDataSource *)bindToQuery:(FIRDatabaseQuery *)query
90+
- (FUICollectionViewDataSource *)bindToQuery:(FIRDatabaseQuery *)query
9191
populateCell:(UICollectionViewCell *(^)(UICollectionView *,
9292
NSIndexPath *,
9393
FIRDataSnapshot *))populateCell {
94-
FirebaseCollectionViewDataSource *dataSource =
95-
[[FirebaseCollectionViewDataSource alloc] initWithQuery:query view:self populateCell:populateCell];
94+
FUICollectionViewDataSource *dataSource =
95+
[[FUICollectionViewDataSource alloc] initWithQuery:query view:self populateCell:populateCell];
9696
self.dataSource = dataSource;
9797
return dataSource;
9898
}

FirebaseDatabaseUI/FirebaseDataSource.h renamed to FirebaseDatabaseUI/FUIDataSource.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@
2020

2121
@import Foundation;
2222

23-
#import "FirebaseArray.h"
23+
#import "FUIArray.h"
2424

2525
@class FIRDatabaseReference;
2626

2727
/**
28-
* A FirebaseDataSource is a generic superclass for all Firebase datasources,
28+
* FUIDataSource is a generic superclass for all Firebase datasources,
2929
* like
30-
* FirebaseTableViewDataSource and FirebaseCollectionViewDataSource. It provides
30+
* FUITableViewDataSource and FUICollectionViewDataSource. It provides
3131
* properties that all
3232
* subclasses need as well as several methods that pass through to the instance
3333
* of FirebaseArray.
3434
*/
35-
@interface FirebaseDataSource : NSObject<FirebaseArrayDelegate>
35+
@interface FUIDataSource : NSObject<FUIArrayDelegate>
3636

3737
/**
3838
* The items in the data source.
@@ -44,7 +44,7 @@
4444
*/
4545
@property (nonatomic, readonly) NSUInteger count;
4646

47-
- (instancetype)initWithArray:(FirebaseArray *)array NS_DESIGNATED_INITIALIZER;
47+
- (instancetype)initWithArray:(FUIArray *)array NS_DESIGNATED_INITIALIZER;
4848
- (instancetype)init NS_UNAVAILABLE;
4949

5050
/**

FirebaseDatabaseUI/FirebaseDataSource.m renamed to FirebaseDatabaseUI/FUIDataSource.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@
1818

1919
// clang-format on
2020

21-
#import "FirebaseDataSource.h"
21+
#import "FUIDataSource.h"
2222

23-
@interface FirebaseDataSource ()
23+
@interface FUIDataSource ()
2424

2525
@property(copy, nonatomic, nonnull) void (^cancelBlock)(NSError *);
2626

2727
/**
2828
* The FirebaseArray which backs the instance of the datasource.
2929
*/
30-
@property(strong, nonatomic, nonnull) FirebaseArray *array;
30+
@property(strong, nonatomic, nonnull) FUIArray *array;
3131

3232
@end
3333

34-
@implementation FirebaseDataSource
34+
@implementation FUIDataSource
3535

3636
#pragma mark - Initializer methods
3737

38-
- (instancetype)initWithArray:(FirebaseArray *)array {
38+
- (instancetype)initWithArray:(FUIArray *)array {
3939
self = [super init];
4040
if (self) {
4141
_array = array;
@@ -66,7 +66,7 @@ - (void)cancelWithBlock:(void (^)(NSError *))block {
6666
self.cancelBlock = block;
6767
}
6868

69-
#pragma mark - FirebaseArrayDelegate methods
69+
#pragma mark - FUIArrayDelegate methods
7070

7171
- (void)canceledWithError:(NSError *)error {
7272
if (self.cancelBlock != nil) {

0 commit comments

Comments
 (0)