Thanks for the reply! During the last couple of days, this has turned into quite a mysterious journey. I am now at the point where I don't think it has anything to do with UIKit at all, and might possibly be more widespread.
Here's what I have tried:
presentsWithTransaction = true, maximumDrawableCount = 3, custom Metal view using CADisplayLink set to 60 fps, present(_: ): 12-20-12 cadence occurs sometimes, mostly after interactions with UIKit
presentsWithTransaction = true, maximumDrawableCount = 3, custom Metal view using CADisplayLink set to 60 fps, present(afterMinimumDuration: 0.016): 12-20-12 cadence persists. From my perspective, this is already an indication that something under the hood might be wrong: why is a frame being displayed for 12 ms when the minimum duration is set to 16 ms?
I have then started to take out most of my custom code, starting with replacing my custom Metal view with an MTKView. The problem persisted. I then took out my custom UIKit overlay - still, the problem persisted. I tried switching to double-buffering by setting maximumDrawableCount = 2 - now, the 12-20-12 cadence seems to occur all the time, not just after interactions with UIKit.
Today, I wanted to try a different approach and started from a blank Xcode project. I added an MTKView, set preferredFramesPerSecond = 60 and: the 12-20-12 cadence showed up again(!).
I have uploaded the project here.
I have also noticed that when I set the minimum duration to 0.016 when double-buffering, the frames are being displayed for much longer (around 250 ms). The two problems might be unrelated, but this behavior can also be found in the sample project and I wanted to at least mention it here.
FB9860634
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: