You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swift-ci opened this issue
May 14, 2020
· 3 comments
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of softwareIRGenLLVM IR generation
I have a protocol that allows view controllers to be instantiated from storyboards. It reads like this:
protocolStoryboardControllerwhereSelf: UIViewController { /// Creates a view controller using the name of the controller to load a storyboard///////// - parameter named: _(optional)_ The name of the storyboard to load from. This defaults to `String(describing: Self)`/// - parameter bundle: _(optional)_ The bundle to load the storyboard from. This defaults to the main bundle./// - returns: An instance of the controller implementing this method, instantiated from the storyboard with the same name.staticfuncinstanceFromStoryboard(namedname: String?, bundle: Bundle?) throws -> Self
}
extensionStoryboardControllerwhereSelf: UIViewController {
staticfuncinstanceFromStoryboard(namedname: String? = nil, bundle: Bundle? = nil) throws -> Self {
letname = name ?? String(describing: self).components(separatedBy: ".").last!
letstoryboard = UIStoryboard(name: name, bundle: bundle)
guardletcandidate = storyboard.instantiateInitialViewController() else {
throwViewControllerFromStoryboardError.failedToFindInitial(storyboard: storyboard)
}
guardletcontroller = candidateas? Selfelse {
throwViewControllerFromStoryboardError.initialViewControllerInvalidType(expected: Self.self, found: type(of: candidate))
}
returncontroller
}
}
extensionUIViewController: StoryboardController { }
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of softwareIRGenLLVM IR generation
Additional Detail from JIRA
md5: 326a8b155e9973d739a0209db6a23700
Issue Description:
I have a protocol that allows view controllers to be instantiated from storyboards. It reads like this:
It produces a segfault:
The text was updated successfully, but these errors were encountered: