Latest 1.0.0
Homepage https://github.com/Meniny/Battery
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation, UIKit
Authors

Battery is an easy-to-use class to monitor battery status on iOS.

Also see MXBatteryMointor for Objective-C version.

Installation

CocoaPods

pod 'Battery'

Usage

import Battery
Battery.mointor.onBatteryStateChanged = { (state) in
  print("State: " + state.stringValue)
}

Battery.mointor.onBatteryLevelChanged = { (level) in
  print("Level: " + (level.percentString() ?? "Unknown"))
}
Battery.mointor.start()
let level = Battery.mointor.batteryLevel
let state = Battery.mointor.batteryState
let levelString = Battery.mointor.batteryLevelString
let stateString = Battery.mointor.batteryStateString
Battery.monitor.stop()

Latest podspec

{
    "name": "Battery",
    "version": "1.0.0",
    "summary": "An easy-to-use class to monitor battery status on iOS.",
    "description": "Battery is an easy-to-use class to monitor battery status on iOS.",
    "homepage": "https://github.com/Meniny/Battery",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Elias Abel": "[email protected]"
    },
    "social_media_url": "https://meniny.cn",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/Meniny/Battery.git",
        "tag": "1.0.0"
    },
    "source_files": "Battery/*",
    "public_header_files": "Battery/*.h",
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This