0

I have a navigationController set and whenever I push a new ViewController using

navigationController?.pushViewController(registrationViewController, animated: true)

The CPU usage of the app goes up to 100% for no reason.

I used Time Profiler to know better what was causing this CPU overuse, and I found out that the process _CFRunLoopRun is taking a lot of CPU capacity.

To be honest I don't know what could cause the problem since the presentation of the view controller and the viewcontroller itself it's really easy.

let registrationViewController = tryVC2()
navigationController?.pushViewController(registrationViewController, animated: true)

I also noticed that this only happens when I use pushViewController method, and not when I use presentViewController.

I would really appreciate If you could point me in the right direction in order to solve this problem.

EDIT:

Screenshot 1 Screenshot 2

1 Answers1

0

I had this exact same issue. I had a SpriteKit skView in one view controller and when I pushed another view controller onto the navigation stack the CPU would jump to over 100%. Fixed it by setting isPaused = true on the skView before navigating away.

Rob
  • 1