IB_DESIGNABLE build error when using a class from within a structure

I created a new built-in framework. In the framework, I created a class called "WBButton", which is a subclass of UIButton. I set IB_DESIGNABLE and added IBInspectable attributes to allow configuration through the interface builder, as described here .

It works great when I test it from my frameworks (by adding a .xib sample and placing a button on the screen), but when I add a custom button to a folder in a project that contains a framework, I get a "Build Failed" message next to "Designables " (see below).

Also, what does “module” mean in the interface builder?

enter image description here

+5
source share
3 answers

Xcode 6 has an error that breaks the IB_DESIGNABLE classes defined in a static library or structure. Same thing with CocoaPods, which use a static library for all Pods.

+4
source

This seems to be a Xcode bug

Temporary workaround:

Create an empty category / extension in the target containing the storyboard or nib that you want to use in the resolvable view.

Swift:

 extension CustomView { } 

Objective-C:

 //.h @interface CustomView (Category) @end //.m @implementation CustomView (Category) @end 
0
source

@ Andy's note above is the correct answer, if you use CocoaPods and your user library is not working, you need to uncomment use_frameworks! in your subfile and "pod install" again.

Apparently, "IB_DESIGNABLE" is not recognized by Xcode unless you do so.

0
source

Source: https://habr.com/ru/post/1209652/


All Articles