IBDesignable doesn't work if project contains a watch kit extension

I have a project that contains a watchkit extension, this prevents IBDesignable:s from working at all in Xcode 9.2 due to the following error that occurs when Xcode tries to build the project to access the designables:


Build WatchAppTest for IBDesignables

Build target WatchAppTest WatchKit Extension of project WatchAppTest with configuration Debug

Check dependencies

target specifies product type 'com.apple.product-type.watchkit2-extension', but there's no such product type for the 'iphonesimulator' platform

Build failed 2018-01-18, 20:05

The above output is the result of just creating a new app with a watch app using Xcode 9.2 and adding an IBDesignable UIView which is referenced from a storyboard. I believe Xcode is trying to build an aggregate target that it creates by itself for designables but the watch kit extension shouldn't be included.


If I remove the watchkit app then the designable starts working, the designable is only in the app code and has nothing to do with the watch app.


Are there any workarounds? This is quite annoying. It does seem to work in Xcode 9.1

Replies

I also ran into this issue today. This is really annoying, especially because the intrinsic content size of my views being calculated in code, I also get a lot of warnings about Auto-Layout inconsistencies now. 😟

The same issue here, I remove anything related to Watch extension and the storyboard render the views without any issues, but this happens with Xcode 9.2, in Xcode 9.1 and the old Xcode versions there is no issue with watch extension.

Same here. Have spent all day on this and am blocked by this issue. Have you found any workaround?

If you are using the old build system, did you try with the new build system (or vice versa)?


Also, I suggest you give Xcode 9.3 beta 3 a try. If it fails there, submit a bug report. (The best time to get bugs looked at and fixed is while it's in beta.)

What is the "old build system" / "new build system" ?


I loathe to spend time making a project to demonstrate this to submit a radr, only to have it duplicated and lose all visibility.

'new build system' is new w/Xcode 9


See: h ttp://jamesdempsey.net/2017/06/13/new-xcode-build-system-and-buildsettingextractor/

Same problem in Xcode 9.3 beta 3. I have reported it as a bug now with a sample project and everything...


Really hope this gets fixed.

Good job Roland4711


Did you copy it to openradar ?

Now I have done so: rdar://37841641

Also happening for me. If the watchOS target is present in my workspace, IBDesignable is broken (and the layouts of my xib also look messed up) with Xcode 9.3. When I have my workspace set to the "old" build system I at least get an error in Report navigator pointing to the watchKit2 extension as the problem, but if I use the new build system, it just fails silently.

Did anyone find a solution? I'm on Xcode 9.4 and I'm still having the same issue. Interestingly, when I have a designable view directly derived from UIView, it works (it renders realtime in IB). But I've created a new designable view that derives from my derived view, it fails to render with the error in the original question.

Hi,

I opened a radar in Bug Reporter, they closed it since it was a duplicate. It means they found it. But I can't access to the original but for "security and privacy reasons", so I don't know WHEN it'll be fixes... It's all I know for the moment..