IBDesignable view shows "updating", and not displaying custom view in InterfaceBuilder

I've been trying to make and view an @IBDesignable view in Interface Builder, but unfortunately with little success.


When I select the view in my Storyboard, the Custom Class inspector shows the Designables: highlight as "updating", without any changes regardless of my actions.


I've done a clean build and build, and the build compiles with no warnings.


When I run the code in the simulator, I'm able to see the resulting visual code and there's no warnings or errors, but it doesn't appear to be showing up in the Interface Builder.


I've tried removing the DerivedData and then restarting my laptop and Xcode to clear any ephemeral issues, to no effect.


I have "Automatically Refresh Views" disabled at the moment - I've tried it both enabled and disabled, with no effect.


When I attempt to select the view and choose Editor -> Debug Selected Views, the status spinner at the top of XCode shows "Preparing to debug instance of "GridColorSelectionView" - and an error is reported in Xcode:



The specific PID changes with the attempts, but the error code is consistent.


I've looked in ~/Library/Logs/DiagnosticReports/, but not seen anything that would give me a hint of what might be failing.


Is there something I'm missing, a setting or something - or does anyone have a suggestion on how I might be able to debug this issue?


I'm not conversant enough to know if this is an issue with something I've done (or am doing), or if it's a candidate for a bug report on Xcode.


- This is with the latest Xcode - Version 10.2 (10E125), running on MacOS 10.14.4 (18E226)

Answered by heckj in 354896022

Found the solution! The error message for the failed build encouraged me to dig through all the pieces, and I noticed that you could specify the Module for a UI element as well as the custom class name. It defaults to following the target set for the file, but you can specifically update it - so when I updated it to my application target name, it resolved, build reported correctly, and is fully updated - including visually displaying in Interface Builder

This morning I got a different error. It reported "build failed" - The project is an IOS Swift application, and it reported this error:


> Could not find a suitable designable built product for the target "PicturegridTests". The built product "/Users/heckj/Library/Developer/Xcode/DerivedData/Picturegrid-cajklmrantioadhobwprxvshvqm/Build/Intermediates.noindex/IBDesignables/Products/Debug-iphonesimulator/PicturegridTests.xctest" does not exist in the file system. Make sure you built products contains either an application or a framework product.



I looked in the filesystem and project - I have PicturegridTests, and it's compiling and testing properly. In the directory it mentions, there's no `PicturegridTests.xctest` , instead there's a `PicturegridTests.swiftmodule` directory - is this a change with the most recent Xcode by chance?

Accepted Answer

Found the solution! The error message for the failed build encouraged me to dig through all the pieces, and I noticed that you could specify the Module for a UI element as well as the custom class name. It defaults to following the target set for the file, but you can specifically update it - so when I updated it to my application target name, it resolved, build reported correctly, and is fully updated - including visually displaying in Interface Builder

Thanks for feed back and congrats for having solved.


Don't forget to close the thread on your answer.

I am using Xcode 12.1.
No errors, everything builds fine. But as soon as I added another ViewController - the IBDesignable on the previous controller doesn't work and it just shows
'designables updating' all the time.
I have cleaned, closed down,, re-opened, re-built countless times. I deleted derived data (as suggested elsewhere), no difference.


Apple has done a shit job with 12.1. All the excuses in the world doesn't make up for the horrible application.
IBDesignable view shows "updating", and not displaying custom view in InterfaceBuilder
 
 
Q