Full Customizable, Beautiful gauge view.
Completely written with ShapeLayers and CoreGraphic to get a most clean and smooth, everything!
[ Now with more options to customize! ]
- Xcode 9+
- Swift 4
- iOS 8+
Drag GDGauge.swift
to your project and use!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target '<Your Target Name>' do
pod 'GDGauge'
end
pod update
then pod install
override func viewDidLoad() {
super.viewDidLoad()
// Create and instatiate the view and set parameters
speed = GDGaugeView(frame: view.bounds)
// Set main gauge view color
speed.baseColor = UIColor.cyan
// Show circle border
speed.showBorder = true
// Show full circle border if .showBorder is set to true
speed.fullBorder = false
// Set starting degree based on zero degree on bottom center of circle space
speed.startDegree = 45.0
// Set ending degree based on zero degree on bottom center of circle space
speed.endDegree = 270.0
// Minimum value
speed.min = 0.0
// Maximum value
speed.max = 16
// Determine each step value
speed.stepValue = 4.0
// Color of handle
speed.handleColor = UIColor.cyan
// Color of seprators
speed.sepratorColor = UIColor.black
// Color of texts
speed.textColor = UIColor.black
// Center indicator text
speed.unitText = "mb/s"
// Center indicator font
speed.unitTextFont = UIFont.systemFont(ofSize: 10)
// Indicators text
speed.textFont = UIFont.systemFont(ofSize: 20)
view.addSubview(speed)
/// After configuring the component, call setupView() method to create the gauge view
speed.setupView()
}
GDGauge is available under the MIT license. See the LICENSE.txt file for more info.