Search code examples
iosxcodeinterface-builderxcode7ibdesignable

Controlling the targets Interface Builder builds for IB_DESIGNABLE / IBDesignable


I'm trying to make use of IB_DESIGNABLE in my app.

The problem is my app is huge and takes an appreciable amount of time to build (ie. many minutes), so I would like keep all my custom views in a separate target and have Interface Builder only build that target to satisfy.

Whatever I try, Xcode seems to build all the targets in my project when doing Interface Builder's "designable" build, even if I move all the storyboards and IB_DESIGNABLE classes into their own framework and remove them from all other targets. The majority of the code in question is written in Objective-C.

Is there anyway to configure or trick interface builder into only building the target I want it to build? I've tried googling but have failed to turn up anything that describes how interface builder decides what to build or how to influence it.


Solution

  • By received wisdom from an IB team member:

    If you're looking for faster IBDesignable build times, put custom UI code in it's own framework. IB only builds the target w/ the designable

    Here's an example of that strategy implemented in the wild.

    Sure doesn't look like there's any way to accomplish this without the separate framework.