【发布时间】:2017-11-02 06:59:16
【问题描述】:
我正在使用库URLEmbeddedView
它在其库中定义了以下代码:
func addConstraints(with view: UIView, center: CGPoint, multiplier: CGFloat = 1) {
view.translatesAutoresizingMaskIntoConstraints = false
addConstraints([
(.centerX, center.x),
(.centerY, center.y)
]
.flatMap {
.init(item: view,
attribute: $0,
relatedBy: .equal,
toItem: self,
attribute: $0,
multiplier: multiplier,
constant: $1)
})
}
我们正在通过库生成链接预览,但出现以下错误:
无法将类型 (_, _) -> _ 的值转换为预期的参数类型 '((_, CGFloat)) -> _" 在 .flapMap 行。
我熟悉Objective-C,但不熟悉Swift。代码中会出现什么问题?
【问题讨论】:
-
您使用的是哪个 iOS 版本?
-
我们正在检查 iOS 10.1 @PGDev
-
您在哪一行遇到问题?
-
@PGDev 我附上了一张图片以获取更多信息。
标签: ios swift nslayoutconstraint