Medium/KMCGeigerCounter

Name: KMCGeigerCounter

Owner: Medium

Description: A framerate meter that clicks like a Geiger counter when your animation drops a frame

Forked from: kconner/KMCGeigerCounter

Created: 2016-08-22 21:17:00.0

Updated: 2016-11-03 01:09:35.0

Pushed: 2016-04-13 07:23:13.0

Homepage:

Size: 846

Language: Objective-C

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

KMCGeigerCounter

KMCGeigerCounter is a framerate meter that clicks like a Geiger counter when your animation drops a frame.

A Geiger counter detects invisible radiation particles and alerts you to what you can't see. Dropped frames aren't invisible, but it can be hard to tell the difference between 55 and 60 fps. KMCGeigerCounter makes those five dropped frames obvious.

The onscreen framerate meter shows two numbers:

The meter is orange when you've dropped at least three frames in the past second.

Installation

pod 'KMCGeigerCounter'

Or copy these files into your project:

If you're not using CocoaPods, you may need to add these frameworks to your Link Binary With Libraries build phase:

Usage

In your UIApplicationDelegate, enable the tool:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // ?
    [self.window makeKeyAndVisible];

    [KMCGeigerCounter sharedGeigerCounter].enabled = YES;
}

Then, build and run your app. Navigate through your app and listen for clicks.

Known issue

If you use view controller based status bar style, your -preferredStatusBarStyle will be ignored, because UIKit asks the meter window for that instead of your main window. I could avoid this by giving the meter window a root view controller, but then that would affect navigation bar height. I'd appreciate any ideas about this.

Doesn't adding a view to my app slow it down?

Maybe. If the meter view causes frames to drop, the app's performance was probably toeing the line too closely in the first place.

Dumb things you probably thought of, but seriously

Remember to turn off Silent mode, or you won't hear anything.

You should remove KMCGeigerCounter before shipping to the App Store. It can't be good for battery life.

The iOS Simulator doesn't simulate device performance, so consider enabling the tool only for device builds:

#if !TARGET_IPHONE_SIMULATOR
[KMCGeigerCounter sharedGeigerCounter].enabled = YES;
#endif

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.