Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions FirebaseUI/Core/API/FirebaseArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@
*/
- (Firebase *)refForIndex:(NSUInteger)index;

/**
* Support for subscripting. Resolves to objectAtIndex:
* @param index The index of the item to retrieve
* @return The object at the given index
*/
- (id)objectAtIndexedSubscript:(NSUInteger)idx;

/**
* Support for subscripting. This method is unused and trying to write directly to the
* array using subscripting will cause an assertion.
*/
- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx;

#pragma mark -
#pragma mark Private API methods

Expand Down
8 changes: 8 additions & 0 deletions FirebaseUI/Core/Implementation/FirebaseArray.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,12 @@ - (Firebase *)refForIndex:(NSUInteger)index {
return [(FDataSnapshot *)[self.snapshots objectAtIndex:index] ref];
}

- (id)objectAtIndexedSubscript:(NSUInteger)index{
return [self objectAtIndex:index];
}

- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)index{
NSAssert(NO, @"Subscripting is read-only on FirebaseArray");
}

@end