- Display FPS (up to 120Hz)
- Drag to move
- Customize appearance
- Optional “geiger counter” functionality that reports dropped frames as an audible click
- Support Swift package manager
- iOS 14.0+
Please check Optimizing ProMotion Refresh Rates for iPhone 13 Pro and iPad Pro to adapt high refresh rate.
import UIKit
#if DEBUG
import FPSIndicator
#endif
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
#if DEBUG
var fpsIndicator: FPSIndicator?
#endif
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
window?.rootViewController = UINavigationController(rootViewController: ViewController())
window?.makeKeyAndVisible()
#if DEBUG
fpsIndicator = FPSIndicator(windowScene: windowScene)
FPSIndicator.geigerCounterEnabled = true // optional
FPSIndicator.geigerEnableWhenFrameDropBeyond = 20 // tick when frame drop more then 20FPS (a.k.a under 40FPS in 60FPS device)
#endif
// Note:
// The FPSIndicator will create a overlay transparent window
// which may break your status bar apperance by accident.
}
}
Cirno MainasuK – @MainasuK – cirno.mainasuk@gmail.com
Distributed under the MIT license. See LICENSE for more information.