SKBatteryStatusData

Objective-C

@interface SKBatteryStatusData : SKSensorData

Swift

class SKBatteryStatusData : SKSensorData

An instance of SKBatteryStatusData encapsulates measurements related to the Battery Status sensor.

  • Unavailable

    Undocumented

    Declaration

    Objective-C

    - (instancetype)init NS_UNAVAILABLE;
  • Unavailable

    Undocumented

    Declaration

    Objective-C

    - (nonnull instancetype)initWithSensorType:(SKSensorType)sensorType
                                     timestamp:
                                         (nonnull SKSensorTimestamp *)timestamp;
  • Returns an SKBatteryStatusData object, initialized with measurements of the battery level, as well as the battery state.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithLevel:(CGFloat)level
                                    state:(UIDeviceBatteryState)state
                        lowPowerModeState:(SKLowPowerModeState)lowPowerModeState;

    Swift

    init(level: CGFloat, state: UIDevice.BatteryState, lowPowerModeState: SKLowPowerModeState)

    Parameters

    level

    A float number that indicates the current battery charge level. Value ranges from 0.0 (fully discharged) to 1.0 (fully charged).

    state

    An enumerator that descrives the state of the battery, classified as Charging, Full, Unplugged or Unknown.

    Return Value

    An SKBatteryStatusData object.

  • A float number that indicates the current battery charge level. Value ranges from 0.0 (fully discharged) to 1.0 (fully charged).

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat level;

    Swift

    var level: CGFloat { get }
  • An enumerator that describes the state of the battery, classified as Charging, Full, Unplugged or Unknown.

    Declaration

    Objective-C

    @property (nonatomic, readonly) UIDeviceBatteryState state;

    Swift

    var state: UIDevice.BatteryState { get }
  • A string value that describes the state of the battery, classified as Charging, Full, Unplugged or Unknown.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull stateString;

    Swift

    var stateString: String { get }
  • An enumerator that descrived the state of the device’s Low Power Mode, classified as Disabled or Enabled.

    Declaration

    Objective-C

    @property (nonatomic, readonly) SKLowPowerModeState lowPowerModeState;

    Swift

    var lowPowerModeState: SKLowPowerModeState { get }
  • A string value that describes the state of the device’s Low Power Mode, classified as Disabled or Enabled.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull lowPowerModeStateString;

    Swift

    var lowPowerModeStateString: String { get }
  • A string with a CSV formatted header that describes the data of the Battery Status sensor. This method is useful in combination with the csvString instance method of an SKSensorData object.

    Declaration

    Objective-C

    + (nonnull NSString *)csvHeader;

    Swift

    class func csvHeader() -> String

    Return Value

    A string with a CSV header.