0
cocoapods로 permissionScope를 설치할 때 신속한 3 구문으로 변환해야했지만 그로 인해 발생하는 대부분의 오류는 매우 간단했습니다. 그러나 시퀀스 확장이 작동하지 않는 6 가지 오류가 있습니다. 정확히.스위프트 2 반복자 확장자가 Swift에서 작동하지 않습니다.
extension SequenceType {
func first(@noescape includeElement: Generator.Element -> Bool) -> Generator.Element? {
for x in self where includeElement(x) { return x }
return nil
}
}
및 SWIFT 3
extension Sequence {
func first(_ includeElement: (Iterator.Element) -> Bool) -> Iterator.Element? {
for x in self where includeElement(x) { return x }
return nil
}
}
가 빠른 2의 본질적으로 동일한 사용되며 신속한 3
func requiredAuthorized(_ completion: @escaping (Bool) -> Void) {
getResultsForConfig{ (results) -> Void in
let result = results
.first { $0.status != .authorized }
.isNil
completion(result)
}
}
:
이
는 스위프트 2 버전의 확장 3을 제외하고는 오류가 발생합니다.ambiguous use of 'first(where:)'