@IBDesignable prepareForInterfaceBuilder does not set up outlets

Originator:mb
Number:rdar://FB7634981 Date Originated:Mar 21, 2020 at 1:52 PM
Status:Open Resolved:Open
Product:Xcode Product Version:Version 11.3.1 (11C504)
Classification:Application Crash Reproducible:Always
 
When using @IBDesignable and implementing `prepareForInterfaceBuilder` on a custom view, the agent crashes when trying to access an outlet of that view in the method.

See the attached sample project.

Please list the steps you took to reproduce the issue:
1. Make a view @IBDesignable
2. Implement the instance method `prepareForInterfaceBuilder`
3. Attempt to access an outlet property of that view.

What did you expect to happen?

The code runs and modified the object at that outlet.

What actually happened?

The following error occurs when opening the nib: 

error: IB Designables: Failed to render and update auto layout status for DesignableView (iN0-l3-epB): The agent crashed

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!