File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 102102 */
103103- (Firebase *)refForIndex : (NSUInteger )index ;
104104
105+ /* *
106+ * Support for subscripting. Resolves to objectAtIndex:
107+ * @param index The index of the item to retrieve
108+ * @return The object at the given index
109+ */
110+ - (id )objectAtIndexedSubscript : (NSUInteger )idx ;
111+
112+ /* *
113+ * Support for subscripting. This method is unused and trying to write directly to the
114+ * array using subscripting will cause an assertion.
115+ */
116+ - (void )setObject : (id )obj atIndexedSubscript : (NSUInteger )idx ;
117+
105118#pragma mark -
106119#pragma mark Private API methods
107120
Original file line number Diff line number Diff line change @@ -152,4 +152,12 @@ - (Firebase *)refForIndex:(NSUInteger)index {
152152 return [(FDataSnapshot *)[self .snapshots objectAtIndex: index] ref ];
153153}
154154
155+ - (id )objectAtIndexedSubscript : (NSUInteger )index {
156+ return [self objectAtIndex: index];
157+ }
158+
159+ - (void )setObject : (id )obj atIndexedSubscript : (NSUInteger )index {
160+ NSAssert (NO , @" Subscripting is read-only on FirebaseArray" );
161+ }
162+
155163@end
You can’t perform that action at this time.
0 commit comments