这与这个问题有关,它没有帮助我解决我的问题,我也检查了这个~/Library/Logs/DiagnosticReports
并得到了IBDesignablesAgentCocoaTouch_*.crash
文件,检查它显示了这个
我尝试删除派生数据,重新启动 Xcode,但没有解决。
我使用的操作系统是 macOS high Sierra
我现在已经注意到,每当我从情节提要切换到另一个文件或更改情节提要中的设备时,Xcode 变为(无响应),然后我将不得不强制退出并再次重新启动 Xcode。
编辑:我将此代码用于状态栏外观
UIApplication.shared().statusBarStyle = .lightContent
UIApplication.shared() .isStatusBarHidden = false
对于@IBDesignable
extension UIView {
class func loadNib<T: UIView>(_ viewType: T.Type) -> T {
let className = String.className(viewType)
return Bundle(for: viewType).loadNibNamed(className, owner: nil, options: nil).first as! T
}
class func loadNib() -> Self {
return loadNib(self)
}
}
@IBDesignable extension UIView {
@IBInspectable var borderColor:UIColor? {
set {
layer.borderColor = newValue!.cgColor
}
get {
if let color = layer.borderColor {
return UIColor(cgColor:color)
}
else {
return nil
}
}
}
@IBInspectable var borderWidth:CGFloat {
set {
layer.borderWidth = newValue
}
get {
return layer.borderWidth
}
}
@IBInspectable var cornerRadius:CGFloat {
set {
layer.cornerRadius = newValue
clipsToBounds = newValue > 0
}
get {
return layer.cornerRadius
}
}
}
有任何想法吗?