CBLReadOnlyArray

@protocol
    CBLReadOnlyArray <NSObject, CBLReadOnlyArrayFragment, NSFastEnumeration>

CBLReadOnlyArray protocol defines a set of methods for readonly accessing array data.

  • Gets a number of the items in the array.

    Declaration

    Objective-C

    @property (readonly, atomic) NSUInteger count;
  • Gets value at the given index as an object. The object types are CBLBlob, CBLReadOnlyArray, CBLReadOnlyDictionary, NSNumber, or NSString based on the underlying data type; or nil if the value is nil. - parameter: index the index. @result the object or nil.

    Declaration

    Objective-C

    - (nullable id)objectAtIndex:(NSUInteger)index;

    Parameters

    index
  • Gets value at the given index as a boolean. Returns YES if the value exists, and is either true or a nonzero number. - parameter: index the index. @result the boolean value.

    Declaration

    Objective-C

    - (BOOL)booleanAtIndex:(NSUInteger)index;

    Parameters

    index
  • Gets value at the given index as an integer. Floating point values will be rounded. The value true is returned as 1, false as 0. Returns 0 if the value doesn’t exist or does not have a numeric value. - parameter: index the index. @result the integer value.

    Declaration

    Objective-C

    - (NSInteger)integerAtIndex:(NSUInteger)index;

    Parameters

    index
  • Gets value at the given index as a float. Integers will be converted to float. The value true is returned as 1.0, false as 0.0. Returns 0.0 if the value doesn’t exist or does not have a numeric value. - parameter: index the index. @result the float value.

    Declaration

    Objective-C

    - (float)floatAtIndex:(NSUInteger)index;

    Parameters

    index
  • Gets value at the given index as a double. Integers will be converted to double. The value true is returned as 1.0, false as 0.0. Returns 0.0 if the property doesn’t exist or does not have a numeric value. - parameter: index the index. @result the double value.

    Declaration

    Objective-C

    - (double)doubleAtIndex:(NSUInteger)index;

    Parameters

    index
  • Gets value at the given index as a string. Returns nil if the value doesn’t exist, or its value is not a string. - parameter: index the index. @result the NSString object or nil.

    Declaration

    Objective-C

    - (nullable NSString *)stringAtIndex:(NSUInteger)index;

    Parameters

    index
  • Gets value at the given index as a number. Returns nil if the value doesn’t exist, or its value is not a number. - parameter: index the index. @result the NSNumber object or nil.

    Declaration

    Objective-C

    - (nullable NSNumber *)numberAtIndex:(NSUInteger)index;

    Parameters

    index
  • Gets value at the given index as an NSDate. JSON does not directly support dates, so the actual property value must be a string, which is then parsed according to the ISO-8601 date format (the default used in JSON.) Returns nil if the value doesn’t exist, is not a string, or is not parseable as a date. NOTE: This is not a generic date parser! It only recognizes the ISO-8601 format, with or without milliseconds. - parameter: index the index. @result the NSDate object or nil.

    Declaration

    Objective-C

    - (nullable NSDate *)dateAtIndex:(NSUInteger)index;

    Parameters

    index
  • Get value at the given index as a CBLBlob. Returns nil if the value doesn’t exist, or its value is not a CBLBlob. - parameter: index the index. @result the CBLBlob object or nil.

    Declaration

    Objective-C

    - (nullable CBLBlob *)blobAtIndex:(NSUInteger)index;

    Parameters

    index
  • Get value at the given index as a CBLReadOnlyDictionary, which is a mapping object of a dictionary value. Returns nil if the value doesn’t exists, or its value is not a dictionary. - parameter: index the index. @result the CBLReadOnlyDictionary object or nil.

    Declaration

    Objective-C

    - (nullable CBLReadOnlyDictionary *)dictionaryAtIndex:(NSUInteger)index;

    Parameters

    index
  • Gets value as a CBLReadOnlyArray, which is a mapping object of an array value. Returns nil if the value doesn’t exists, or its value is not an array. - parameter: index the index. @result the CBLReadOnlyArray object or nil.

    Declaration

    Objective-C

    - (nullable CBLReadOnlyArray *)arrayAtIndex:(NSUInteger)index;

    Parameters

    index
  • Gets content of the current object as an NSArray. The values contained in the returned NSArray object are all JSON based values. @result the NSArray object representing the content of the current object in the JSON format.

    Declaration

    Objective-C

    - (nonnull NSArray *)toArray;