问题
I have a .xib file with extensive usage of IBDesignable
views. As view grown I noticed constant CPU load. Now, my view is really big and when I open it in interface builder, ActivityMonitor show this:
. It continues even if I leave .xib file and go to code. The only solution to stop it is to close, then open Xcode and don't open .xib file until it is really necessary. My rough assumption is that Xcode continues compiling my project/views in background to maintain IBDesignable
views in actual state.
What should I do to prevent wasting CPU?
If it could make any sense - my mac configuration: MacBook Pro (Retina, 15-inch, Mid 2015), 2.5 GHz Intel Core i7, 16 GB 1600 MHz DDR3
回答1:
I've got pretty much same issue and solved it by removing all IBDesignable
from project, but then I realized that you can just disable Automatically Refresh Views
in Editor
menu as mentioned here.
Issue returned later on just to some XIBs. The reason was Top Bar
in Simulated Metrics
on this view, which is really unexpected. Removing all simulated metrics solves CPU loading issue for me.
来源:https://stackoverflow.com/questions/41546591/xcode-ibdesignablesagentcocoatouch-loads-cpu-infinitely