Xcode keeps building storyboard after each keystroke
Solution 1
It is caused by the IB_DESIGNABLE
definitions in the source header files. Probably it makes problem only if the header file containing IB_DESIGNABLE
is included (even implicitly) to the source file you are currently editing.
I did not find a definitive solution how to disable IB_DESIGNABLE
and thus compiling the storyboard and the source files continuously. I would appreciate an Xcode flag to disable this temporarily. I tried also surrounding the IB_DESIGNABLE
with #ifdef
macros but they are considered even if the #ifdef
evaluates to false. Commenting out one by one the IB_DESIGNABLE
helps but it is not a feasible solution with many IB_DESIGNABLE
s.
Update
I finally found a quick way to avoid this annoying behavior. Having the storyboard opened in the active window, disable "Automatically Refresh Views" from the Editor menu. This will stop updating the views in the storyboard editor that use your custom code and thus speed up your development significantly. When you need again the just-in-time compiling to have a visual preview of your custom code, enable this option again (it seems you also have to re-open your storyboard to make it working again).
You may wish to add a key binding to the command, such as command-option-control-A, to easily toggle the behavior on/off. To add a key binding in Xcode, touch command-comma for preferences, choose the Key Bindings tab, use the search bar to find the command, then double-click on the right area to add your desired keystroke.
"Leave it off" approach
Alternately turn "Automatically Refresh Views" off, and never turn it on.
Make a convenient keystroke for "Refresh all views", say command-option-shift-R
As you work, just touch command-option-shift-R from time to time, or as needed. It's generally only necessary to touch command-option-shift-R as you work on the storyboard.
Solution 2
I had this problem and the accepted answer did not work for me.
The problem I had was that I always keep the storyboard open in it's own tab within XCode so that I can access it quickly.
The only way I could fix it was to either close that tab or select a different file (like a normal code file) and then close and reopen XCode. Thereafter it was no longer rebuilding on each keystroke.
Be warned however if you need to open the storyboard to make changes then this problem can sometimes reappear and I will have to repeat the above process.
Can't wait till Apple fixes this as it is very frustrating indeed!
(ノಠ益ಠ)ノ彡┻━┻
![MrTJ](https://i.stack.imgur.com/6HYg4.jpg?s=256&g=1)
MrTJ
I am a software developer focused primary on mobile platforms writing code that gets the whole hog out from the devices we all have in our pockets every day. Scrum enthusiast, seeking every day to write beautiful code and to inspire others to do so.
Updated on September 28, 2020Comments
-
MrTJ almost 4 years
My Xcode project using a storyboard entered in a very weird state recently: Xcode keeps building the whole project and notably the storyboard after each keypress. I found no reason for this behavior neither in my project diffing all interesting files (storyboard and project) neither a setting in Xcode (maybe I just could not find it?) Needless to say that this "feature" makes working on my project nearly impossible since the CPU is constantly occupying with rebuilding the storyboard when I type new code. Anybody seen this?
-
MandisaW almost 9 yearsNot sure how it got turned on, but turning off "Automatically Refresh Views" solved my problem
-
arjavlad almost 9 yearsIt's frustrating. It keeps building project event after I Turned off "Automatically Refresh Views". Mine is Xcode 7. I have 5 storyboards. And Only 1 is opened in other tab.
-
Vakas over 8 yearsI’m on Xcode 7.2 and this solution solved my problem.
-
Oleksii Taran over 8 yearsXcode 7.3 is constantly building project when active editor has storyboard opened. Luckily this answer solved my problem. Apple keeps impressing me...
-
leanne about 8 yearsOn Xcode 7.3, I remarked out the IBDesignable attributes, compiled, and it started working. I then un-remarked the IBDesignable, and it continued working properly!
-
Dielson Sales almost 8 yearsThis doesn't happen only with Storyboards, I was having the same problem with XIBs.
-
David Seek over 7 yearsfreaking finally... my xcode 8.1 kept building and building and building... works with 8.2 beta as well. but the long building process itself hasnt been solved. at all
-
Fattie over 7 yearsThis would have to be one of the best answers on the whole site. Sending a bounty to say thanks! I added an image showing the menu choice. Thanks a million @MrTJ, you rock
-
MrTJ over 7 yearsthanks, my pleasure to help. also great work improving the answer!
-
Arshak over 7 years@MrTJ I can't seem to find the "Automatically refresh Views" in Editor on xcode 8.2.1
-
MrTJ over 7 years@Arshak make sure to have an IB document (xib or storyboard) opened when you try it
-
MrTJ over 7 years@Arshak well I think the whole point of Playgrounds is that they are continuously compiled as you enter code :)
-
Arshak over 7 years@MrTJ Thanks alot
-
korgx9 over 7 yearsXcode Version 8.2.1 (8C1002) problem solved. When I found this answer and it solve my problem, I couldn't stop my tears. I spent 2 days in nightmare deleting derived data, cleaning project, reinstalling all pods. ( I think it is time for apple, give all development of IDE to Jetbrains. What apple do it is just a shit! Thank you!
-
Anurag Sharma about 7 yearsThank you so much! I was getting this issue even in Xcode 8.3. Just disabled "Automatically refresh Views" and restarted my Xcode. Now it's fine.
-
PhilippeAuriach almost 7 yearsI would send you all my rep if possible ! Thanks @MrTJ !
-
Chauyan almost 7 yearsThanks a lot, xcode keeps building really makes me feel upset.
-
P.L. almost 7 yearsThis solution works on Xcode 9 too. Turn of "Automatically Refresh Views" in Storyboard, and no more constant re-building. Thank you so much!
-
andreamazz over 6 yearsThank you, I was running circles to fix this problem. It's shocking that in Xcode 9 it rebuilds everything even if you change a space in a comment.
-
Joshua Vidamo about 6 yearsThank you so much for this. It doesn't make storyboard on Xcode 9 magically fast but it helps a bit.
-
Carl Hine over 5 yearsOMG! This was completely doing my head in. I do have the IB_DESIGNABLES in play. Quite why Xcode has to continually re-build, like every other minute and cause the environment to free-fall into editor-performance-hell, is quite beyond me. So, great. This teensy-teensy setting has helped.
-
RyuX51 over 4 yearsXcode 11.4 here. Some things have come to stay. 🤷
-
Utku Dalmaz over 3 yearsYou SIR saved my life! -> XCode 12.4
-
MrTJ over 3 years6 years passed, I don't work with iOS since years, but people keep thanking me for this answer... maybe it's time for Apple to rethink the UX of Xcode..?