CBLFragment
@protocol CBLFragment <NSObject>
CBLFragment protocol provides read access to the data value wrapped by a fragment object.
-
Gets the value as an object. The object types are CBLBlob, CBLArray, CBLDictionary, NSNumber, or NSString based on the underlying data type; or nil if the value is nil.
Declaration
Objective-C
@property (readonly, nonatomic, nullable) NSObject *value;Swift
var value: NSObject? { get } -
Gets the value as a string. Returns nil if the value is nil, or the value is not a string.
Declaration
Objective-C
@property (readonly, nonatomic, nullable) NSString *string;Swift
var string: String? { get } -
Gets the value as a number. Returns nil if the value is nil, or the value is not a number.
Declaration
Objective-C
@property (readonly, nonatomic, nullable) NSNumber *number;Swift
var number: NSNumber? { get } -
Gets the value as an integer. Floating point values will be rounded. The value
trueis returned as 1,falseas 0. Returns 0 if the value is nil or is not a numeric value.Declaration
Objective-C
@property (readonly, nonatomic) NSInteger integerValue;Swift
var integerValue: Int { get } -
Gets the value as a long long. Floating point values will be rounded. The value
trueis returned as 1,falseas 0. Returns 0 if the value is nil or is not a numeric value.Declaration
Objective-C
@property (readonly, nonatomic) long long longLongValue;Swift
var longLongValue: Int64 { get } -
Gets the value as a float. Integers will be converted to float. The value
trueis returned as 1.0,falseas 0.0. Returns 0.0 if the value is nil or is not a numeric value.Declaration
Objective-C
@property (readonly, nonatomic) float floatValue;Swift
var floatValue: Float { get } -
Gets the value as a double. Integers will be converted to double. The value
trueis returned as 1.0,falseas 0.0. Returns 0.0 if the value is nil or is not a numeric value.Declaration
Objective-C
@property (readonly, nonatomic) double doubleValue;Swift
var doubleValue: Double { get } -
Gets the value as a boolean. Returns YES if the value is not nil nor NSNull, and is either
trueor a nonzero number.Declaration
Objective-C
@property (readonly, nonatomic) BOOL booleanValue;Swift
var booleanValue: Bool { get } -
Gets the value 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 is nil, 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.
Declaration
Objective-C
@property (readonly, nonatomic, nullable) NSDate *date;Swift
var date: Date? { get } -
Get a property’s value as a CBLDictionary, a mapping object of a dictionary value. Returns nil if the value is nil, or the value is not a dictionary.
Declaration
Objective-C
@property (readonly, nonatomic, nullable) CBLDictionary *dictionary;Swift
var dictionary: CBLDictionary? { get } -
Checks whether the value held by the fragment object exists or is nil value or not.
Declaration
Objective-C
@property (readonly, nonatomic) BOOL exists;Swift
var exists: Bool { get }
CBLFragment Protocol Reference