13

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.

JosephH
  • 37,173
  • 19
  • 130
  • 154
  • 1
    Would love to know that considering I have just spent 2 hours trying to exclude iOS only libraries from the IB build which requires x86 architecture. – Sulthan Jul 06 '16 at 14:02
  • I believe that with Swift the build is really simple. If you use a designable, IB will build the module which contains that designable. A module is a target and that target is being built. Therefore probably the best solution is to move the designables to a separate target, that is, a separate Swift module. – Sulthan Jul 06 '16 at 14:32

1 Answers1

13

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.

Alex Curylo
  • 4,744
  • 1
  • 27
  • 37
  • Thanks alexcurylo! Have some bounty. Will have to give this a go again, very useful to have a working example to compare against. – JosephH Jul 13 '16 at 10:31