Setting up API for openweathermap. However, when it comes to setting up this:
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [C
switch response.result {
case .success(let value):
print("Alamo value: \(value)")
break
case .failure(let error):
print("Alamo error: \(error)")
break
}
Thanks for trying Alamofire 5! This error is a bit misleading, as the Swift compiler is trying to be helpful and letting you know there's an internal
property value
on response.result
that you can't access. However, this is an internal Alamofire extension, as we moved to the Result type provided by the Swift standard library in Alamofire 5 beta 4. The system Result
does not offer the the value
and error
properties that Alamofire's previously provided Result
type did. So while we have extensions internally to provide functionality to us, they do not exist publicly for use by your app.
The ultimate solution here is up to you. You can extend Result
yourself to offer the properties (feel free to use the Alamofire implementation) or you can do without the properties and switch
over the response.result
value to extract the response value. I would suggest using switch
for now, as it forces you to consider the .failure
case.
In the latest beta 4
version Alamofire switched to using the new standard Result type, so the convenience properties we used to have have been made internal. Now you can switch over the result like this:
switch response.result {
case let .success(value): ...
case let .failure(error): ...
}
Or you can make similar extensions in your own project. They won't be offering the extensions publicly anymore.