Hi!
I'm adding the OfficeUIFabric pod as described on the README.md and trying to use the components included into this library, but the Xcode's Interface Builder designer crashes if I use a custom class for a button changing it to MSButton
.
The minimal reproduction of the error is contained on this repository https://github.com/OrlSan/officeuifabric-sb-demo
Although the application is actually compiling and running the Interface Builder is displaying a blank canvas just containing the base UIViewController
frames, but nothing else:
Xcode is displaying the Issue message Main.storyboard: error: IB Designables: Failed to render and update auto layout status for ViewController (BYZ-38-t0r): The agent crashed
The Diagnostic report found on ~/Library/Logs/DiagnosticReports
is pointing the error as the following:
Application Specific Information:
CoreSimulator 587.35 - Device: iPhone 8 (72039265-FC19-42F2-BCF0-99B04E1058F5) - Runtime: iOS 12.2 (16E226) - DeviceType: iPhone 8
/Users/orlando/Desktop/OfficeUIFabric Demo/Pods/OfficeUIFabric/OfficeUIFabric/Controls/MSButton.swift: 27: 12: Fatal error: Use of unimplemented initializer 'init(frame:)' for class 'OfficeUIFabric.MSButton'
The full crash log is here: IBDesignablesAgent-iOS_2019-05-22-161443_d4nger.crash.txt
What I've tried
As fas as I'm understanding the MSButton
class (subclass of UIButton
) is crashing the designer because the init(frame:)
initializer is not implemented. I actually tried to change the source code and added the initializer so the MSButton
implementation will include the following:
@objc public init(style: MSButtonStyle = .secondaryOutline) {
self.style = style
super.init(frame: .zero)
initialize()
}
// Added this initializer
@objc public override init(frame: CGRect) {
super.init(frame: frame)
initialize()
}
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initialize()
}
But again Xcode is displaying an empty canvas and the error is Main.storyboard: error: IB Designables: Failed to render and update auto layout status for BNInitialViewController (BYZ-38-t0r): Failed to load designables from path (null)
I don't know if the implementation of the initializer is the correct way to address this issue because the IB is not displaying the canvas anyway. Seems like an issue with the Autolayout resolution or something related.
Additional information
Xcode: Version 10.2.1 (10E1001)
macOS version: macOS Mojave Version 10.14.5
Pod version: OfficeUIFabric (~> 0.2.0)
I appeciate your help on this Issue, and if you have any questions please let me know.
Thanks!