Skip to content

Commit d409b14

Browse files
committed
Merge pull request #4 from firebase/mm-add-examples
0.2.3 Release Candidate
2 parents 33bd35d + dad02dd commit d409b14

30 files changed

+1339
-45
lines changed

FirebaseUI.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Pod::Spec.new do |s|
22
s.name = "FirebaseUI"
3-
s.version = "0.2.1"
3+
s.version = "0.2.3"
44
s.summary = "UI binding libraries for Firebase."
55
s.homepage = "https://github.com/firebase/FirebaseUI-iOS"
66
s.license = { :type => 'MIT', :file => 'LICENSE' }
77
s.author = { "Firebase" => "[email protected]" }
88
s.social_media_url = "https://twitter.com/firebase"
9-
s.source = { :git => "https://github.com/firebase/FirebaseUI-iOS.git", :tag => 'v0.2.1' }
9+
s.source = { :git => "https://github.com/firebase/FirebaseUI-iOS.git", :tag => 'v0.2.3' }
1010
s.source_files = "FirebaseUI/**/*.{h,m}"
1111
s.dependency "Firebase", "~> 2.2"
1212
s.platform = :ios

FirebaseUI.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@
119119
D8B6ACEA1B5839F7005CDDB2 /* Implementation */ = {
120120
isa = PBXGroup;
121121
children = (
122-
D8DF55611B742DB40030E996 /* FirebaseCollectionViewDataSource.m */,
123122
D8B6ACEF1B583C41005CDDB2 /* FirebaseArray.m */,
124123
D8B6ACF21B583C41005CDDB2 /* FirebaseDataSource.m */,
125124
D8B6ACF11B583C41005CDDB2 /* FirebaseTableViewDataSource.m */,
125+
D8DF55611B742DB40030E996 /* FirebaseCollectionViewDataSource.m */,
126126
);
127127
name = Implementation;
128128
sourceTree = "<group>";

FirebaseUI/API/FirebaseCollectionViewDataSource.h

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
*/
4444
@property (strong, nonatomic, __NON_NULL) Class modelClass;
4545

46+
/**
47+
* The cell class to coerce UICollectionViewCells to (if desired). For instance, if the cellClass is set to [CustomCollectionViewCell class] in Obj-C or CustomCollectionViewCell in Swift, then objects of type CustomCollectionViewCell will be returned instead of type UICollectionViewCell.
48+
*/
49+
@property (strong, nonatomic, __NON_NULL) Class cellClass;
50+
4651
/**
4752
* The reuse identifier for cells in the UICollectionView.
4853
*/
@@ -53,10 +58,15 @@
5358
*/
5459
@property (strong, nonatomic, __NON_NULL) UICollectionView *collectionView;
5560

61+
/**
62+
* Property to keep track of prototype cell use, to not register a class for the UICollectionView or do similar book keeping.
63+
*/
64+
@property BOOL hasPrototypeCell;
65+
5666
/**
5767
* The callback to populate a subclass of UICollectionViewCell with an object provided by the datasource.
5868
*/
59-
@property (strong, nonatomic, __NON_NULL) void(^populateCell)(UICollectionViewCell * __NON_NULL_PTR cell, NSObject * __NON_NULL_PTR object);
69+
@property (strong, nonatomic, __NON_NULL) void(^populateCell)(__kindof UICollectionViewCell * __NON_NULL_PTR cell, __kindof NSObject * __NON_NULL_PTR object);
6070

6171
/**
6272
* Initialize an instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with FDataSnapshots.
@@ -65,7 +75,16 @@
6575
* @param collectionView An instance of a UICollectionView to bind to
6676
* @return An instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with FDataSnapshots
6777
*/
68-
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
78+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
79+
80+
/**
81+
* Initialize an instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with FDataSnapshots. Note that this method is used when using prototype cells, where the cells don't need to be registered in the class.
82+
* @param ref A Firebase reference to bind the datasource to
83+
* @param identifier A string to use as a CellReuseIdentifier
84+
* @param collectionView An instance of a UICollectionView to bind to
85+
* @return An instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with FDataSnapshots
86+
*/
87+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref prototypeReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
6988

7089
/**
7190
* Initialize an instance of FirebaseCollectionViewDataSource that populates a custom subclass of UICollectionViewCell with FDataSnapshots.
@@ -75,7 +94,7 @@
7594
* @param collectionView An instance of a UICollectionView to bind to
7695
* @return An instance of FirebaseCollectionViewDataSource that populates a custom subclass of UICollectionViewCell with FDataSnapshots
7796
*/
78-
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref cellClass:(__NULLABLE Class)cell reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
97+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref cellClass:(__NULLABLE Class)cell cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
7998

8099
/**
81100
* Initialize an instance of FirebaseCollectionViewDataSource that populates a custom xib with FDataSnapshots.
@@ -85,7 +104,7 @@
85104
* @param collectionView An instance of a UICollectionView to bind to
86105
* @return An instance of FirebaseCollectionViewDataSource that populates a custom xib with FDataSnapshots
87106
*/
88-
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref nibNamed:(__NON_NULL NSString *)nibName reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
107+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref nibNamed:(__NON_NULL NSString *)nibName cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
89108

90109
/**
91110
* Initialize an instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with a custom model class.
@@ -95,7 +114,17 @@
95114
* @param collectionView An instance of a UICollectionView to bind to
96115
* @return An instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with a custom model class
97116
*/
98-
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
117+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
118+
119+
/**
120+
* Initialize an instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with a custom model class. Note that this method is used when using prototype cells, where the cells don't need to be registered in the class.
121+
* @param ref A Firebase reference to bind the datasource to
122+
* @param model A custom class that FDataSnapshots are coerced to, defaults to FDataSnapshot if nil
123+
* @param identifier A string to use as a CellReuseIdentifier
124+
* @param collectionView An instance of a UICollectionView to bind to
125+
* @return An instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with a custom model class
126+
*/
127+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model prototypeReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
99128

100129
/**
101130
* Initialize an instance of FirebaseCollectionViewDataSource that populates a custom subclass of UICollectionViewCell with a custom model class.
@@ -106,7 +135,7 @@
106135
* @param collectionView An instance of a UICollectionView to bind to
107136
* @return An instance of FirebaseCollectionViewDataSource that populates a custom subclass of UICollectionViewCell with a custom model class
108137
*/
109-
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model cellClass:(__NULLABLE Class)cell reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
138+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model cellClass:(__NULLABLE Class)cell cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
110139

111140
/**
112141
* Initialize an instance of FirebaseCollectionViewDataSource that populates a custom xib with a custom model class.
@@ -117,12 +146,12 @@
117146
* @param collectionView An instance of a UICollectionView to bind to
118147
* @return An instance of FirebaseCollectionViewDataSource that populates a custom xib with a custom model class
119148
*/
120-
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model nibNamed:(__NON_NULL NSString *)nibName reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
149+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model nibNamed:(__NON_NULL NSString *)nibName cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView;
121150

122151
/**
123152
* This method populates the fields of a UICollectionViewCell or subclass given an FDataSnapshot (or custom model object).
124153
* @param callback A block which returns an initialized UICollectionViewCell (or subclass) and the corresponding object to populate the cell with.
125154
*/
126-
- (void)populateCellWithBlock:(__NON_NULL void(^)(UICollectionViewCell * __NON_NULL_PTR cell, NSObject * __NON_NULL_PTR object))callback;
155+
- (void)populateCellWithBlock:(__NON_NULL void(^)(__kindof UICollectionViewCell * __NON_NULL_PTR cell, __kindof NSObject * __NON_NULL_PTR object))callback;
127156

128157
@end

FirebaseUI/API/FirebaseTableViewDataSource.h

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,15 @@
5353
*/
5454
@property (strong, nonatomic, __NON_NULL) UITableView *tableView;
5555

56+
/**
57+
* Property to keep track of prototype cell use, to not register a class for the UICollectionView or do similar book keeping.
58+
*/
59+
@property BOOL hasPrototypeCell;
60+
5661
/**
5762
* The callback to populate a subclass of UITableViewCell with an object provided by the datasource.
5863
*/
59-
@property (strong, nonatomic, __NON_NULL) void(^populateCell)(UITableViewCell * __NON_NULL_PTR cell, NSObject * __NON_NULL_PTR object);
64+
@property (strong, nonatomic, __NON_NULL) void(^populateCell)(__kindof UITableViewCell * __NON_NULL_PTR cell, __kindof NSObject * __NON_NULL_PTR object);
6065

6166
/**
6267
* Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with FDataSnapshots.
@@ -65,7 +70,16 @@
6570
* @param tableView An instance of a UITableView to bind to
6671
* @return An instance of FirebaseTableViewDataSource that populates UITableViewCells with FDataSnapshots
6772
*/
68-
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
73+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
74+
75+
/**
76+
* Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with FDataSnapshots. Note that this method is used when using prototype cells, where the cells don't need to be registered in the class.
77+
* @param ref A Firebase reference to bind the datasource to
78+
* @param identifier A string to use as a CellReuseIdentifier
79+
* @param tableView An instance of a UITableView to bind to
80+
* @return An instance of FirebaseTableViewDataSource that populates UITableViewCells with FDataSnapshots
81+
*/
82+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref prototypeReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
6983

7084
/**
7185
* Initialize an instance of FirebaseTableViewDataSource that populates a custom subclass of UITableViewCell with FDataSnapshots.
@@ -75,7 +89,7 @@
7589
* @param tableView An instance of a UITableView to bind to
7690
* @return An instance of FirebaseTableViewDataSource that populates a custom subclass of UITableViewCell with FDataSnapshots
7791
*/
78-
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref cellClass:(__NULLABLE Class)cell reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
92+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref cellClass:(__NULLABLE Class)cell cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
7993

8094
/**
8195
* Initialize an instance of FirebaseTableViewDataSource that populates a custom xib with FDataSnapshots.
@@ -85,7 +99,7 @@
8599
* @param tableView An instance of a UITableView to bind to
86100
* @return An instance of FirebaseTableViewDataSource that populates a custom xib with FDataSnapshots
87101
*/
88-
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref nibNamed:(__NON_NULL NSString *)nibName reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
102+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref nibNamed:(__NON_NULL NSString *)nibName cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
89103

90104
/**
91105
* Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with a custom model class.
@@ -95,7 +109,17 @@
95109
* @param tableView An instance of a UITableView to bind to
96110
* @return An instance of FirebaseTableViewDataSource that populates UITableViewCells with a custom model class
97111
*/
98-
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
112+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
113+
114+
/**
115+
* Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with a custom model class. Note that this method is used when using prototype cells, where the cells don't need to be registered in the class.
116+
* @param ref A Firebase reference to bind the datasource to
117+
* @param model A custom class that FDataSnapshots are coerced to, defaults to FDataSnapshot if nil
118+
* @param identifier A string to use as a CellReuseIdentifier
119+
* @param tableView An instance of a UITableView to bind to
120+
* @return An instance of FirebaseTableViewDataSource that populates UITableViewCells with a custom model class
121+
*/
122+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model prototypeReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
99123

100124
/**
101125
* Initialize an instance of FirebaseTableViewDataSource that populates a custom subclass of UITableViewCell with a custom model class.
@@ -106,7 +130,7 @@
106130
* @param tableView An instance of a UITableView to bind to
107131
* @return An instance of FirebaseTableViewDataSource that populates a custom subclass of UITableViewCell with a custom model class
108132
*/
109-
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model cellClass:(__NULLABLE Class)cell reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
133+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model cellClass:(__NULLABLE Class)cell cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
110134

111135
/**
112136
* Initialize an instance of FirebaseTableViewDataSource that populates a custom xib with a custom model class.
@@ -117,13 +141,13 @@
117141
* @param tableView An instance of a UITableView to bind to
118142
* @return An instance of FirebaseTableViewDataSource that populates a custom xib with a custom model class
119143
*/
120-
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model nibNamed:(__NON_NULL NSString *)nibName reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
144+
- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model nibNamed:(__NON_NULL NSString *)nibName cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView;
121145

122146
/**
123147
* This method populates the fields of a UITableViewCell or subclass given a model object (or FDataSnapshot).
124148
* @param callback A block which returns an initialized UITableViewCell (or subclass) and the corresponding object to populate the cell with.
125149
*/
126-
- (void)populateCellWithBlock:(__NON_NULL void(^)(UITableViewCell * __NON_NULL_PTR cell, NSObject * __NON_NULL_PTR object))callback;
150+
- (void)populateCellWithBlock:(nonnull void (^)(__kindof UITableViewCell * __NON_NULL_PTR cell, __kindof NSObject * __NON_NULL_PTR object))callback;
127151

128152
@end
129153

0 commit comments

Comments
 (0)