我有一个用varUIButton
实现的简单子类:IBDesignable
IBInspectable
@IBDesignable class Button: UIButton {
@IBInspectable var borderColor: UIColor = UIColor.whiteColor() {
didSet { layer.borderColor = borderColor.CGColor }
}
}
我没有在框架中使用它,它在 Interface Builder 中按预期工作,但是,一旦我将此子类添加到我的Tests
目标,它就会停止实时渲染,并且我收到以下错误:
Main.storyboard: error: IB Designables: Failed to update auto layout status: dlopen(TestTests.xctest, 1): Library not loaded: @rpath/XCTest.framework/XCTest
Referenced from: TestTests.xctest
Reason: image not found
Main.storyboard: error: IB Designables: Failed to render instance of Button: dlopen(TestTests.xctest, 1): Library not loaded: @rpath/XCTest.framework/XCTest
Referenced from: TestTests.xctest
Reason: image not found
如果我删除IBDesignable
了IBInspectable
变量,错误就会消失——不幸的是,Interface Builder 中的实时渲染也是如此。
如何在IBDesignable
没有这些错误的情况下针对类进行测试?