我尝试创建对约束的引用,然后设置布局优先级,但这会使应用程序崩溃
let topTrasactionConstraint = transactionsTableviewContainer.topAnchor.constraint(equalTo: buttonsStackContainerView.bottomAnchor, constant: 6)
NSLayoutConstraint.activate([
topTrasactionConstraint,
transactionsTableviewContainer.centerXAnchor.constraint(equalTo: contentView.centerXAnchor),
transactionsTableviewContainer.widthAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.widthAnchor, constant: -20),
transactionsTableviewContainer.heightAnchor.constraint(equalToConstant: 500)
])
topTrasactionConstraint.priority = UILayoutPriority.init(999)
Run Code Online (Sandbox Code Playgroud) 我正在尝试编写以下功能
func take<C: Collection where C.Iterator.Element Int>(_ value: C) {
print(value.first)
}
Run Code Online (Sandbox Code Playgroud)
但是我一直收到编译器错误:
'where' clause next to generic parameters is obsolete, must be written following the declaration's type
Run Code Online (Sandbox Code Playgroud)