Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode keeps building storyboard after each keystroke

People also ask

How do I stop auto build in Xcode?

Thankfully, you can disable these automatic rebuilds by opening any file in Interface Builder, going to Editor menu and unchecking Automatically Refresh Views. After this change, you'll now have to manually trigger an IB-specific build when you want to see the preview of your @IBDesignable views.

Should I use storyboard in Xcode?

Another benefit to using Storyboards (over creating views programmatically) is that you get to see what your view will look like at runtime without having to run your app. You can quickly make a change in Interface Builder and immediately see what it'll look like – without waiting for Xcode to compile and run.

Why is Main storyboard not showing up in Xcode?

You have SwiftUI enabled in your project, which does not use storyboards anymore. Your layout is inside the ContentView. swift file. If you do want to work the old way, with storyboards, you should uncheck 'Use SwiftUI' in the project creation screen.


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_DESIGNABLEs.

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).

enter image description here

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

enter image description here

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.


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!

(ノಠ益ಠ)ノ彡┻━┻