-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCWFirebaseCollection.h
66 lines (39 loc) · 1.93 KB
/
CWFirebaseCollection.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// CWFirebaseCollection.h
//
// Created by Clément Wehrung on 08/04/2014.
// Copyright (c) 2014 Clément Wehrung. All rights reserved.
//
#import <Firebase/Firebase.h>
#import "CWCollection.h"
@protocol CWFirebaseCollectionModelProtocol <CWCollectionModelProtocol>
@optional
- (Firebase *)reference;
- (void)remove;
@end
@protocol CWFirebaseCollectionDelegate <CWCollectionDelegate>
@optional
- (void)collection:(CWCollection *)collection modelAdded:(id<CWCollectionModelProtocol>)model atIndex:(NSUInteger)index inBatch:(BOOL)inBatch;
@property (nonatomic, strong, readonly) Firebase* reference;
@end
@protocol CWFirebaseCollectionDataSource <CWCollectionDataSource>
@required
- (void)collection:(CWCollection *)collection prepareModelWithData:(FDataSnapshot *)dataSnapshot completion:(CWCollectionPrepareResult)completionBlock;
@end
@interface CWFirebaseCollection : CWCollection <CWFirebaseCollectionDataSource>
@property (nonatomic, strong, readonly) Firebase* reference;
@property (nonatomic, assign, readonly) BOOL isLoading;
@property (nonatomic, strong, readonly) FDataSnapshot *lastDataSnapshot;
@property (nonatomic, assign) id <CWFirebaseCollectionDataSource> dataSource;
@property (nonatomic, assign) id <CWFirebaseCollectionDelegate> delegate;
@property (nonatomic, assign) NSUInteger batchSize;
@property (nonatomic, assign) BOOL autoStartListeners;
@property (nonatomic, assign, readonly) BOOL hasMore;
- (id)initWithReference:(Firebase *)reference dataSource:(id <CWFirebaseCollectionDataSource>)dataSource;
- (void)listen;
- (void)loadAllWithCompletion:(void (^)(CWCollection *collection, NSArray *models))completion;
- (void)loadMoreWithCompletion:(void (^)(CWCollection *collection, NSArray *models))completion;
- (void)dispose;
#pragma mark - Default Model Implementation
- (void)collection:(CWCollection *)collection prepareModelWithData:(FDataSnapshot *)snapshot completion:(CWCollectionPrepareResult)completionBlock;
@end