Xcode 7에서 8로 프로젝트를 업데이트하는 과정에서 문제가 발생합니다.Swift 3 일반 삽입 연산자 오류
UIView
에 제약 조건을 처리하는 일반 infix
연산자가 있습니다. 내가 가진
for attribute: NSLayoutAttribute in [.left, .right, .top, .bottom] {
(view, self) >>>- {
$0.attribute = attribute
}
}
: 연산자를 사용하여시, 내가 이해하지 못하는 오류를 받고 있어요, 지금
precedencegroup constPrecedence {
associativity: left
higherThan: AssignmentPrecedence
}
infix operator >>>- : constPrecedence
@discardableResult
func >>>- <T: UIView> (left: (T, T), block: (inout ConstraintInfo) ->()) -> NSLayoutConstraint {
var info = ConstraintInfo()
block(&info)
info.secondAttribute = info.secondAttribute == .notAnAttribute ? info.attribute : info.secondAttribute
let constraint = NSLayoutConstraint(item: left.1,
attribute: info.attribute,
relatedBy: info.relation,
toItem: left.0,
attribute: info.secondAttribute,
multiplier: 1,
constant: info.constant)
constraint.identifier = info.identifier
left.0.addConstraint(constraint)
return constraint
}
: 여기
는 운영자의 정의입니다 비 제네릭 함수로도 테스트되었지만 여전히 블록 유형에 대해 불평 할 것입니다.아이디어가 있으십니까?
추신 : 나는 코드 작성자가 아니기 때문에 PR 코드를 업데이트하고 구문을 변경하면 코드가 너무 많이 영향을받습니다.
[mcve]를 게시 할 수 있습니다. – Hamish
코드가 너무 많지 않으므로 어디서든 쉽게 확인할 수 있습니다. 나는 충분한 증거를 제공했다고 생각했다. 그 밖의 무엇이 필요합니까? –
Xcode 8 베타 6에서 이미이 문제를 재현 해 보았습니다. ([this] (https://github.com/Ramotion/paper-onboarding)이 당신이 말하는 GitHub 프로젝트입니까?). 컴파일 예제는 [this gist] (https://gist.github.com/hamishknight/e44bd25823d24dea068e0498fa1cef4b)를 참조하십시오. 아마도 빌드 폴더를 청소 해보십시오. – Hamish