CBLPropertyValueRange

Objective-C

@protocol CBLPropertyValueRange <NSObject>

Swift

protocol PropertyValueRange : NSObjectProtocol

A description of a property’s valid range, if the property is of type CBLPropertyValueSetTypeNumericRange.

  • The range’s minimum value.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSInteger minimumValue;

    Swift

    var minimumValue: Int { get }
  • The range’s maximum value.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSInteger maximumValue;

    Swift

    var maximumValue: Int { get }
  • The range’s step value. For example, if a range has a minimum value of 10, a maximum value of 50, and a step of 10, the range’s valid values would be [10, 20, 30, 40, 50].

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSInteger valueStep;

    Swift

    var valueStep: Int { get }
  • Returns YES is the given value is valid for the receiver’s range range, otherwise NO.

    Declaration

    Objective-C

    - (BOOL)valueIsValid:(NSInteger)value;

    Swift

    func valueIsValid(_ value: Int) -> Bool
  • The number of values in the range.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSInteger numberOfValues;

    Swift

    var numberOfValues: Int { get }
  • Returns the range’s value at the given index in the range [0..<numberOfValues]. If an invalid index is given, this method will throw an Objective-C NSRangeException.

    Declaration

    Objective-C

    - (NSInteger)valueAtIndex:(NSInteger)index;

    Swift

    func value(at index: Int) -> Int
  • Returns an index in the range [0..<numberOfValues] for the given value. If an invalid value is given, this method will throw an Objective-C NSRangeException.

    Declaration

    Objective-C

    - (NSInteger)indexOfValue:(NSInteger)value;

    Swift

    func index(of value: Int) -> Int
  • Returns a display value for the given value in the range, or nil if an invalid value is given.

    Declaration

    Objective-C

    - (NSString *_Nullable)localizedDisplayValueForValue:(NSInteger)value;

    Swift

    func localizedDisplayValue(for value: Int) -> String?