Skip to content

A small library to measure the frame rate of an iOS Application.

License

Notifications You must be signed in to change notification settings

navartis/fps-counter

 
 

Repository files navigation

Carthage compatible CocoaPods License MIT

FPSCounter

A small library to measure the frame rate of an iOS Application.

You can display the current frames per second in the status bar with a single line. Or if you'd like more control, you can have your own code notified of FPS changes and display it as needed.

Note: You should only use this for debugging purposes. Especially the status bar overlay will cause Apple to reject your app when reviewed.

Usage

The easiest way to use this library is to add a label to the status bar:

FPSCounter.showInStatusBar(UIApplication.sharedApplication())

This will replace the status bar with a label that shows the current frames per second the application manages to draw.

If you'd like more control on how to display the frames, you can create a private FPSCounter instance and set a delegate

self.fpsCounter = FPSCounter()
self.fpsCounter.delegate = self

To retrieve updates you need to start tracking the FPS:

self.fpsCounter.startTracking()

If necessary you can specify what run loop and run loop mode to use while tracking:

self.fpsCounter.startTracking(inRunLoop: myRunLoop, mode: UITrackingRunLoopMode)

By default the NSRunLoop.mainRunLoop() and NSRunLoopCommonModes are used.

When you don't want to receive further updates, you can stop tracking:

self.fpsCounter.stopTracking()

Installation

Carthage

To install this library via Carthage add the following to your Cartfile:

github "konoma/fps-counter" ~> 1.0

Then run the standard carthage update process.

CocoaPods

To install this library via CocoaPods add the following to your Podfile:

pod 'FPSCounter', '~> 1.0'

Then run the standard pod update process.

License

FPSCounter is released under the MIT License.

About

A small library to measure the frame rate of an iOS Application.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 78.2%
  • Ruby 19.1%
  • Objective-C 2.7%