I carefully looked for this question, but could not find it in Stack Overflow.
Getting segmentation failure error:
1. While type-checking getter for asset at <invalid loc>
Below is the class code for which I get Segmentation Fault -
import UIKit class WidgetImageTableViewCell: UITableViewCell { @IBOutlet weak var imgViewWidget: UIImageView! var aspectConstraint : NSLayoutConstraint! { didSet { if oldValue != nil { imgViewWidget.removeConstraint(oldValue!) } if aspectConstraint != nil { imgViewWidget.addConstraint(aspectConstraint!) } } } override func prepareForReuse() { super.prepareForReuse() aspectConstraint = nil } func setPostedImage(image : UIImage) { let aspect:CGFloat = image.size.width/image.size.height aspectConstraint = NSLayoutConstraint(item: imgViewWidget, attribute: .width, relatedBy: .equal, toItem: imgViewWidget, attribute: .height, multiplier: aspect, constant: 0.0) imgViewWidget.image = image } override func awakeFromNib() { super.awakeFromNib()
Also, below is a screenshot of the stacktrace that I get when I create it - Image of a stack trace
source share