Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging IBDesignable - debug selected views not working

Recenlty I've made reusable class for rendering IBDesignables xibs in interface view.

@interface ReusableView ()
@property (nonatomic, strong) UIView *contentView;
@end

@implementation ReusableView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    [self setupXib];

    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    [self setupXib];

    return self;
}

- (void)setupXib {
    self.contentView = [self loadFromNib];

    self.contentView.frame = self.bounds;
    self.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    [self addSubview:self.contentView];
}

- (UIView *)loadFromNib {
    NSBundle *bundle = [NSBundle bundleForClass: [self class]];
    UINib *nib = [UINib nibWithNibName:NSStringFromClass([self class]) bundle:bundle];
    UIView *view = (UIView *)[[nib instantiateWithOwner:self options:nil] firstObject];

    return view;
}

@end

So far everything was ok until today. I've changed literally nothing in my code (I've even rolled-back to master branch to be sure) and my xibs using this class are no longer rendering in storyboards.

In interface builder there is information

Designables: Build failed

but the show button does nothing, as well as trying to use Editor > Debug Selected Views. I am unable to hit any breakpoint in my class.

So far I tried:

  • cleaning derived-data
  • restarting x-code
  • killing Interface Builder Cocoa Touch Tool
  • full-restart
  • project clean (in between previously described actions)

Is it some kind of xcode bug or somehow it's my fault? Is it possible to debug Designables any other way than with Debug Selected Views option?

like image 422
Piotr Gawłowski Avatar asked Jul 25 '16 08:07

Piotr Gawłowski


1 Answers

Xcode now shows IB build errors if you click on the "Show Report Navigator" then look at the Interface Build section.

IB Build Errors

like image 82
joels Avatar answered Oct 11 '22 21:10

joels