cohen72
cohen72

Reputation: 2988

IB_DESIGNABLE build failed when using class from within a framework

I created a new embedded framework. Within the framework I created a class called "WBButton", which is a subclass of UIButton. I have set the IB_DESIGNABLE and added IBInspectable attributes to allow configuration through Interface builder, as explained here.

It works fine when I test it from within my framework (by adding a sample .xib and placing the button on the screen), but when adding the custom button to a nib located on the project which contains the framework, I get a "Build Failed" message next to the "Designables" (see below).

Also, what does "Module" mean in Interface builder?

enter image description here

Upvotes: 5

Views: 1758

Answers (3)

GeneCode
GeneCode

Reputation: 7588

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

Apparently the "IB_DESIGNABLE" is not recognized by XCode if you don't do this.

Upvotes: 0

SomeGuy
SomeGuy

Reputation: 9690

It seems this is an Xcode bug

Temporary workaround:

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

Swift:

extension CustomView {

}

Objective-C:

//.h
@interface CustomView (Category)

@end

//.m
@implementation CustomView (Category)

@end

Upvotes: 0

pronebird
pronebird

Reputation: 12240

Xcode 6 has a bug that breaks IB_DESIGNABLE classes defined in static library or framework. The same is with CocoaPods which use static library for all Pods.

Upvotes: 4

Related Questions