Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adventam10/amspeedmeter
AMSpeedMeterView is a view can display the value at regular time intervals.
https://github.com/adventam10/amspeedmeter
ios swift swift4
Last synced: about 1 month ago
JSON representation
AMSpeedMeterView is a view can display the value at regular time intervals.
- Host: GitHub
- URL: https://github.com/adventam10/amspeedmeter
- Owner: adventam10
- License: mit
- Created: 2018-01-13T07:37:49.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-14T11:01:51.000Z (about 5 years ago)
- Last Synced: 2024-09-29T22:21:49.657Z (about 2 months ago)
- Topics: ios, swift, swift4
- Language: Swift
- Homepage: https://qiita.com/am10/items/0fe8cffac7dd7659eb2a
- Size: 35.2 KB
- Stars: 12
- Watchers: 5
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AMSpeedMeter
![Pod Platform](https://img.shields.io/cocoapods/p/AMSpeedMeter.svg?style=flat)
![Pod License](https://img.shields.io/cocoapods/l/AMSpeedMeter.svg?style=flat)
[![Pod Version](https://img.shields.io/cocoapods/v/AMSpeedMeter.svg?style=flat)](http://cocoapods.org/pods/AMSpeedMeter)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)`AMSpeedMeter` is a view can display the value at regular time intervals.
## Demo
![speedmeter](https://user-images.githubusercontent.com/34936885/34904032-a3c3f6da-f880-11e7-99ea-094d83a89e14.gif)
## Usage
```swift
// property
private var speedMeterView: AMSpeedMeterView!
private var timer: Timer?override func viewDidLoad() {
super.viewDidLoad()speedMeterView = AMSpeedMeterView(frame: view.bounds)
view.addSubview(speedMeterView)// customize here
timer = Timer.scheduledTimer(timeInterval: 0.5, target: self,
selector: #selector(self.timerAction(teimer:)),
userInfo: nil, repeats: true)
}/// Timer Action
@objc func timerAction(teimer: Timer) {
/// set CGFloat value
speedMeterView.currentValue = value
}
```### Customization
`AMSpeedMeter` can be customized via the following properties.```swift
@IBInspectable public var maxValue: CGFloat = 100
@IBInspectable public var minValue: CGFloat = 0
@IBInspectable public var numberOfValue: Int = 5
@IBInspectable public var meterBorderLineWidth: CGFloat = 5
@IBInspectable public var valueIndexWidth: CGFloat = 2.0
@IBInspectable public var valueHandWidth: CGFloat = 3.0
@IBInspectable public var meterBorderLineColor: UIColor = .black
@IBInspectable public var meterColor: UIColor = .clear
@IBInspectable public var valueHandColor: UIColor = .red
@IBInspectable public var valueLabelTextColor: UIColor = .black
@IBInspectable public var valueIndexColor: UIColor = .black
public var valueLabelFont: UIFont = .systemFont(ofSize: 15)
public var decimalFormat: AMSMDecimalFormat = .none
public var currentValue: CGFloat = 0.0
```![speed](https://user-images.githubusercontent.com/34936885/66710713-e435b080-edb8-11e9-8107-9c6bacc8f8ae.png)
## Installation
### CocoaPods
Add this to your Podfile.
```ogdl
pod 'AMSpeedMeter'
```### Carthage
Add this to your Cartfile.
```ogdl
github "adventam10/AMSpeedMeter"
```## License
MIT