jtrivedi / Wave

Wave is a spring-based animation engine for iOS and macOS that makes it easy to create fluid, interruptible animations that feel great.

Home Page:https://jtrivedi.github.io/Wave/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DisplayLinkProvider preferredFrameRateRange range error

kushsolitary opened this issue · comments

Hi,

First of all - great library! I am trying this out with SwiftUI (although I think this issue is unrelated) but I am encountering an issue. On my physical device (iPhone 11 Pro), the returned value of UIScreen.main.maximumFramesPerSecond is 61.

This makes the following error out:

        if #available(iOS 15.0, *) {
            let maximumFramesPerSecond = Float(UIScreen.main.maximumFramesPerSecond)
            let highFPSEnabled = maximumFramesPerSecond > 60
            let minimumFPS: Float = highFPSEnabled ? 80 : 60
            displayLinkProvider?.preferredFrameRateRange = .init(minimum: minimumFPS, maximum: maximumFramesPerSecond, preferred: maximumFramesPerSecond)
        }

Error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'invalid range (minimum: 80.00 maximum: 61.00 preferred: 61.00)'

For now, I am forking the repo to increase the highFPSEnabled threshold and see if that works. Is there any other way to make the check work more reliably?

Interesting, good find! Let me take a look 👍

Fixed with release 0.3.2. Thanks for opening the issue!