GDPerformanceView-Swift

GDPerformanceView-Swift 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.

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/GDPerformanceView.framework to an iOS project.

github "dani-gavrilov/GDPerformanceView-Swift" ~> 1.3.2
Ruby

Don't forget to import GDPerformanceView by adding:

import GDPerformanceView
Swift

CocoaPods

You can use CocoaPods to install GDPerformanceView by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!

target 'project_name' do
	pod 'GDPerformanceView-Swift', '~> 1.3.2'
end
Ruby

Don't forget to import GDPerformanceView by adding:

import GDPerformanceView_Swift
Swift

Usage example

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.

You can find example projects here

Start monitoring

Call to start or resume monitoring and show monitoring view.

GDPerformanceMonitor.sharedInstance.startMonitoring()
Swift
self.performanceView = GDPerformanceMonitor.init()
self.performanceView?.startMonitoring()
Swift

Stop monitoring

Call when you're done with performance monitoring.

self.performanceView?.stopMonitoring()
Swift

Call to hide and pause monitoring.

self.performanceView?.pauseMonitoring()
Swift

Configuration

Call to change appearance.

self.performanceView?.configure(configuration: { (textLabel) in
	textLabel?.backgroundColor = .black
	textLabel?.textColor = .white
	textLabel?.layer.borderColor = UIColor.black.cgColor
})
Swift

Call to change output information.

self.performanceView?.appVersionHidden = true

self.performanceView?.deviceVersionHidden = true
Swift

Call to hide monitoring view.

self.performanceView?.hideMonitoring()
Swift

Call to change status bar appearance.

self.performanceView?.configureStatusBarAppearance(prefersStatusBarHidden: false, preferredStatusBarStyle: .lightContent)
Swift

Start monitoring and configure

self.performanceView?.startMonitoring(configuration: { (textLabel) in
	textLabel?.backgroundColor = .black
	textLabel?.textColor = .white
	textLabel?.layer.borderColor = UIColor.black.cgColor
})
Swift

Delegate

Set the delegate and implement its method.

self.performanceView?.delegate = self
Swift
func performanceMonitorDidReport(fpsValue: Int, cpuValue: Float) {
	print(fpsValue, cpuValue)
}
Swift

Requirements

  • iOS 8.0+
  • xCode 9.1+

GitHub

Latest commit to the undefined branch on unknown
Download as zip