用于条件绑定的初始化程序必须具有可选类型,而不是'()->字符串?
如何处理此错误?
func loadViewFromNib() -> UIView? {
let xibName = getXibName()
let bundle = Bundle(for: type(of: self))
let nib = UINib(nibName: xibName!, bundle: bundle)
return nib.instantiate(
withOwner: self,
options: nil).first as? UIView
}
func getXibName() -> String? {
return nil
}