When I was building a user interface component (GMStepper) with
@IBDesignable, Xcode sometimes gave me errors like:
error: IB Designables: Failed to update auto layout status: dlopen(GMStepperExampleTests.xctest
error: IB Designables: Failed to render instance of GMStepper: dlopen(GMStepperExampleTests.xctest, 1): Library not loaded: @rpath/XCTest.framework/XCTest
Even I don’t really know the reason of this error, one way to fix it was deleting the project’s derived data:
Window > Projects > Delete Derive Data and then restarting Xcode. But the error kept coming back whenever I navigated around my files and the storyboard.
As the error message states, it is someting wrong with the the test target. I tried to remove the test target and voila! Later I added a new test target from the test navigator (
CMD + 5). Now I am not getting these errors.
Moreover, if you don’t implement the
init(frame: CGRect) initializer for your component, you will probably get these 2 errors:
error: IB Designables: Failed to update auto layout status: Interface Builder Cocoa Touch Tool crashed
error: IB Designables: Failed to render instance of GMStepper: The designables agent crashed
So you should implement both
init(frame: CGRect) and