Xcode rebuilds the project due to @IBDesignable even when not needed

Number:rdar://35558659 Date Originated:15-Nov-2017 03:12 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 9.1 (9B55)
Classification:Performance Reproducible:Always
When views marked with @IBDesignable are used in the project, Xcode has to build them to be able to render them in Interface Builder. This should happen in two scenarios:

1. When opening a XIB/storyboard file containing a view marked with @IBDesignable.
2. When IB is opened with such a file in a separate tab and you edit the code impacting that view.

However, in the current stable version of Xcode (I haven’t checked older versions) rebuilds are also done in other scenarios.

Steps to Reproduce:
1. Create a project with a view marked with @IBDesignable.
2. Use that view in a XIB or storyboard file.
3. Open any source code file in a tab that has IB open.
4. Save that file without introducing any changes (you can even `touch file.swift` from the command line).

Expected Results:
Project isn’t rebuilt because Interface Builder isn’t open.

Actual Results:
Project is rebuilt, even though the user won’t see the changes until they open Interface Builder.

Xcode 9.1 (9B55)


Disable “Automatically Refresh Views” option under Editor menu (visible only when Interface Builder is open).


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!