Shows FPS, CPU usage, app and iOS versions above the status bar and report FPS and CPU usage via delegate.
Installation
Simply add GDPerformanceMonitoring folder with files to your project, or use CocoaPods.
Platform: ios, '8.0' use_frameworks! Target 'project_name' do pod 'GDPerformanceView-Swift', '~> 1.0.2' end
Copy the code
Usage
Simply start monitoring. Performance view will be added above the status bar automatically. Also, you can configure appearance as you like or just hide the monitoring view and use its delegate.
Call to start or resume monitoring and show monitoring view.
GDPerformanceMonitor.sharedInstance.startMonitoring()
Copy the code
self.performanceView = GDPerformanceMonitor.init() self.performanceView? .startMonitoring()
Copy the code
Stop monitoring
Call when you’re done with performance monitoring.
self.performanceView? .stopMonitoring()
Copy the code
Call to hide and pause monitoring.
self.performanceView? .pauseMonitoring()
Copy the code
Call to change appearance.
self.performanceView? .configure(configuration: { (textLabel) in textLabel? .backgroundColor = UIColor.black textLabel? .textColor = UIColor.white textLabel? .layer.borderColor = UIColor.black.cgColor })
Copy the code
Call to change output information.
self.performanceView? .appVersionHidden = true
Copy the code
self.performanceView? .deviceVersionHidden = true
Copy the code
Call to hide monitoring view.
self.performanceView? .hideMonitoring()
Copy the code
Start monitoring and configure
self.performanceView? .startMonitoring(configuration: { (textLabel) in textLabel? .backgroundColor = UIColor.black textLabel? .textColor = UIColor.white textLabel? .layer.borderColor = UIColor.black.cgColor })
Copy the code
Set the delegate and implement its method.
self.performanceView? .delegate = self
Copy the code
func performanceMonitorDidReport(fpsValue: Float, cpuValue: Float) {
print(fpsValue, cpuValue)
}
Copy the code
Requirements
- IOS 8.0 +
GDPerformanceView is available under the MIT license. See the LICENSE file for more info.