Merge pull request #1968 from zgjie/master
Replace the `firstElementPassingTest` function come from RSCore with …
This commit is contained in:
commit
0e5a9f7ee9
|
@ -70,12 +70,12 @@ public extension OAuthAuthorizationResponse {
|
|||
guard let queryItems = components.queryItems, !queryItems.isEmpty else {
|
||||
throw URLError(.unsupportedURL)
|
||||
}
|
||||
let code = queryItems.firstElementPassingTest { $0.name.lowercased() == "code" }
|
||||
let code = queryItems.first { $0.name.lowercased() == "code" }
|
||||
guard let codeValue = code?.value, !codeValue.isEmpty else {
|
||||
throw URLError(.unsupportedURL)
|
||||
}
|
||||
|
||||
let state = queryItems.firstElementPassingTest { $0.name.lowercased() == "state" }
|
||||
let state = queryItems.first { $0.name.lowercased() == "state" }
|
||||
let stateValue = state?.value
|
||||
|
||||
self.init(code: codeValue, state: stateValue)
|
||||
|
|
|
@ -53,7 +53,7 @@ final class SingleLineTextFieldSizer {
|
|||
// that members of such a dictionary were mutated after insertion.
|
||||
// We use just an array of sizers now — which is totally fine,
|
||||
// because there’s only going to be like three of them.
|
||||
if let cachedSizer = sizers.firstElementPassingTest({ $0.font == font }) {
|
||||
if let cachedSizer = sizers.first(where: { $0.font == font }) {
|
||||
return cachedSizer
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class OpenInSafariActivity: UIActivity {
|
|||
}
|
||||
|
||||
override func perform() {
|
||||
guard let url = activityItems?.firstElementPassingTest({ $0 is URL }) as? URL else {
|
||||
guard let url = activityItems?.first(where: { $0 is URL }) as? URL else {
|
||||
activityDidFinish(false)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue