Just updated to swift 2.0 and I am having an error.
The error I am getting is: 'array' is unavailable: please construct an Array from your lazy sequence: Array(...)
My code is:
if let credentialStorage = session.configuration.URLCredentialStorage {
let protectionSpace = NSURLProtectionSpace(
host: URL!.host!,
port: URL!.port?.integerValue ?? 0,
`protocol`: URL!.scheme,
realm: URL!.host!,
authenticationMethod: NSURLAuthenticationMethodHTTPBasic
)
// ERROR------------------------------------------------↓
if let credentials = credentialStorage.credentialsForProtectionSpace(protectionSpace)?.values.array {
// ERROR------------------------------------------------↑
for credential: NSURLCredential in (credentials) {
components.append("-u \(credential.user!):\(credential.password!)")
}
} else {
if let credential = delegate.credential {
components.append("-u \(credential.user!):\(credential.password!)")
}
}
}
Would anyone know how to convert this line of code to be updated for Swift 2.0?
if let credentials = credentialStorage.credentialsForProtectionSpace(protectionSpace)?.values.array
values.array
tovalues.elements
– Glyn