add accessibility support
This commit is contained in:
parent
fdc9970154
commit
91de2684eb
|
@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- add accessibility support.
|
||||
|
||||
## [1.3.6] - 2019-07-10
|
||||
|
||||
### Added
|
||||
|
|
|
@ -114,6 +114,10 @@ extension Int {
|
|||
|
||||
noLevelLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||
addSubview(noLevelLabel)
|
||||
|
||||
isAccessibilityElement = true
|
||||
accessibilityIdentifier = "battery"
|
||||
accessibilityLabel = "battery"
|
||||
}
|
||||
|
||||
// MARK: - Layout
|
||||
|
@ -160,8 +164,10 @@ extension Int {
|
|||
let levelInset = (isVertical ? levelFrame.height : levelFrame.width) * CGFloat(.fullBattery - level) / CGFloat(Int.fullBattery)
|
||||
(_, levelFrame) = levelFrame.divided(atDistance: levelInset, from: direction)
|
||||
noLevelLabel.text = nil
|
||||
accessibilityValue = level.description
|
||||
} else {
|
||||
noLevelLabel.text = noLevelText
|
||||
accessibilityValue = noLevelText
|
||||
}
|
||||
levelFill.frame = levelFrame.integral
|
||||
layoutCornerRadius()
|
||||
|
|
Loading…
Reference in New Issue