aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Database
diff options
context:
space:
mode:
authorGravatar Ibrahim Ulukaya <ulukaya@gmail.com>2017-11-08 17:22:01 -0500
committerGravatar GitHub <noreply@github.com>2017-11-08 17:22:01 -0500
commit07595ce66bbd90be37940facd8601b3d94eec837 (patch)
treefa0c15255e6f7b33a7bce6bf69819d64639a4a1f /Firebase/Database
parentd400851b29823273036df136eabd815d6ba0d1cf (diff)
Enumerator using generic. Cleaner for .. in .. loop in Swift (#433)
* Enumerator using generic. Cleaner for .. in .. loop in Swift So for childSnapshot in snapshot.children { you don't need to cast each child. Each cild is already known as DataSnapshot * Update FIRDataSnapshot.h * Update FIRMutableData.h * Update FIRMutableData.m
Diffstat (limited to 'Firebase/Database')
-rw-r--r--Firebase/Database/Api/FIRDataSnapshot.m2
-rw-r--r--Firebase/Database/Api/FIRMutableData.m2
-rw-r--r--Firebase/Database/Public/FIRDataSnapshot.h2
-rw-r--r--Firebase/Database/Public/FIRMutableData.h2
4 files changed, 4 insertions, 4 deletions
diff --git a/Firebase/Database/Api/FIRDataSnapshot.m b/Firebase/Database/Api/FIRDataSnapshot.m
index 9559c38..b774493 100644
--- a/Firebase/Database/Api/FIRDataSnapshot.m
+++ b/Firebase/Database/Api/FIRDataSnapshot.m
@@ -87,7 +87,7 @@
return [self.node.node numChildren];
}
-- (NSEnumerator *) children {
+- (NSEnumerator<FIRDataSnapshot *> *) children {
return [[FTransformedEnumerator alloc] initWithEnumerator:self.node.childEnumerator andTransform:^id(FNamedNode *node) {
FIRDatabaseReference *childRef = [self.ref child:node.name];
return [[FIRDataSnapshot alloc] initWithRef:childRef indexedNode:[FIndexedNode indexedNodeWithNode:node.node]];
diff --git a/Firebase/Database/Api/FIRMutableData.m b/Firebase/Database/Api/FIRMutableData.m
index 7e10dcd..77a022a 100644
--- a/Firebase/Database/Api/FIRMutableData.m
+++ b/Firebase/Database/Api/FIRMutableData.m
@@ -110,7 +110,7 @@
return [self.data getNode:self.prefixPath];
}
-- (NSEnumerator *) children {
+- (NSEnumerator<FIRMutableData *> *) children {
FIndexedNode *indexedNode = [FIndexedNode indexedNodeWithNode:self.nodeValue];
return [[FTransformedEnumerator alloc] initWithEnumerator:[indexedNode childEnumerator] andTransform:^id(FNamedNode *node) {
FPath* childPath = [self.prefixPath childFromString:node.name];
diff --git a/Firebase/Database/Public/FIRDataSnapshot.h b/Firebase/Database/Public/FIRDataSnapshot.h
index c3082df..e465045 100644
--- a/Firebase/Database/Public/FIRDataSnapshot.h
+++ b/Firebase/Database/Public/FIRDataSnapshot.h
@@ -134,7 +134,7 @@ FIR_SWIFT_NAME(DataSnapshot)
*
* @return An NSEnumerator of the children.
*/
-@property (strong, readonly, nonatomic) NSEnumerator* children;
+@property (strong, readonly, nonatomic) NSEnumerator<FIRDataSnapshot *>* children;
/**
* The priority of the data in this FIRDataSnapshot.
diff --git a/Firebase/Database/Public/FIRMutableData.h b/Firebase/Database/Public/FIRMutableData.h
index 5c26024..4e7250a 100644
--- a/Firebase/Database/Public/FIRMutableData.h
+++ b/Firebase/Database/Public/FIRMutableData.h
@@ -116,7 +116,7 @@ FIR_SWIFT_NAME(MutableData)
* Note that this enumerator operates on an immutable copy of the child list. So, you can modify the instance
* during iteration, but the new additions will not be visible until you get a new enumerator.
*/
-@property (readonly, nonatomic, strong) NSEnumerator* children;
+@property (readonly, nonatomic, strong) NSEnumerator<FIRMutableData *>* children;
/**