Coder Social home page Coder Social logo

fps-counter's Introduction

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 may 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()

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

You can remove the label any time later:

FPSCounter.hide()

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: .tracking)

By default RunLoop.main and RunLoop.Mode.common 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" ~> 4.1

Then run the standard carthage update process.

CocoaPods

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

pod 'FPSCounter', '~> 4.1'

Then run the standard pod update process.

License

FPSCounter is released under the MIT License.

fps-counter's People

Contributors

freemansion avatar frenetisch-applaudierend avatar galeas avatar giginet avatar guanshanliu avatar tomsemi avatar yas375 avatar zeveisenberg avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.