I see a number of questions about this, but few answers (one answer solved a previous similar issue, but not this one).
THE PROBLEM
I have an IBDesignable class. It derives from UIControl, but the same thing happens if I derive from UIView.
It basically looks like this:
@IBDesignable
open class RVS_Checkbox: UIControl { ... }
It works just fine (the link leads to this project, which is a "drop-in" UIControl class).
But it won't render in Interface Builder. I get this error:
Here is the error, verbatim:
The built product "/Volumes/Development/Developer/Xcode/DerivedData/RVS_Checkbox-ficjiiqrddckmjenmsrbrxvihaky/Build/Intermediates.noindex/IBDesignables/Products/Debug-appletvsimulator/RVS_Checkbox" does not exist in the file system. Make sure your built products contains either an application or a framework product.
First of all, this is a tvOS error, and this is an iOS-only class. I had a similar issue before, and this answer solved that for me. I wrapped the code in the #if...#else...#endif, like so:
#if os(iOS)
@IBDesignable
open class RVS_Checkbox: UIControl { ... }
#else
@IBDesignable
class RVS_Checkbox: UIView { }
#endif
I even gave it an empty "placeholder," in case it needed to be held.
No dice. Whatever I do, the IB error still happens, and the element doesn't render.
Like I said, it still works fine, and also displays the proper inspectable properties:
but it won't render.
Here's the error, next to the directory it's complaining about:
I am sure that I'm doing something wrong, but have no idea what. I tried deleting DerivedData, cleaning the project, tried all 4 of my targets, etc.
No dice.
Any ideas?
OK. I figured it out. It's a bug in Xcode. I submitted a report.
If I open the project on the internal drive, the control renders, no problem.
If I open the project on an external drive, it fails to render.
Very strange, but I was able to reproduce it 100% of the time, using a very simple project.
I suspect that most developers simply get Macs with big internal disks, and do their development on these. I had to get one with a limited internal drive, so I use one of those SanDisk screamers as an external for my development.
I wonder what other issues I may be encountering? I find Xcode to be quite buggy.
UPDATE: I am attaching the two screengrabs used in the bug report.
This demonstrates the setup. I am using the same exact project, in two different places on my system. The one on the left is on the internal MacBook Pro drive, and the one on the right is THE SAME EXACT PROJECT, but on an external drive.