自Swift 3起,我收到此错误:">>> - "生成NSLayoutConstraint,而不是预期的上下文结果类型" Void" (又名"()")在我的项目中。
fileprivate func configurateCell(_ cell: BasePageCollectionCell, backImage: UIImage?) {
cell.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(cell)
// add constraints
[(NSLayoutAttribute.width, cell.bounds.size.width), (NSLayoutAttribute.height, cell.bounds.size.height)].forEach { info in
cell >>>- {
$0.attribute = info.0
$0.constant = info.1
}
}
[NSLayoutAttribute.centerX, .centerY].forEach { attribute in
(view, cell) >>>- { $0.attribute = attribute }
}
cell.layoutIfNeeded()
}