NBGaugeView is a small library to create and display Gauge Views. It is fully customizable: you can set the color, size, text and many other properties of the gauge. This is a simple donut used for displaying text in hollow circle.
- iOS 8+
- Xcode 9.0+
Add the NBGaugeView pod into your project and run pod install
pod 'NBGaugeView'
Download NBGaugeVIew and import NBGaugeView.swift
inside your xcode project.
To start using NBGaugeView you can build the provided example project
- Open
Example/NBGaugeView.xcodeproj
in Xcode. - Build and run.
It's very easy to set up, just import NBGaugeView in your Swift code:
import NBGaugeView
Add an UIView with interface builder and set NBGaugeView
as UIView custom class.
Link it with the outlet property declared in your code.
@IBOutlet private weak var gaugeView: NBGaugeView!
It's simple to customize! Here's an example of configuration of the view.
gaugeView.startAngle = 0
gaugeView.percentage = 60
gaugeView.thickness = 20
gaugeView.labelFont = UIFont.systemFont(ofSize: 40)
gaugeView.labelColor = UIColor.red
gaugeView.gaugeBackgroundColor = UIColor.gray
gaugeView.gaugeColor = UIColor.blue
Radius fo the view is automatically adjusted with min of width and height of the view.
Radius can be fetched using the below property at anytime.
let radius = gaugeView.radius
NBGaugeView is available under the MIT license. See the LICENSE file for more info.