Posts

Post not yet marked as solved
1 Replies
207 Views
The parameters of the completion handler are (data: Optional<Data>, urlResponse: Optional<Data>, error: Optional<Error>). Here is an exhaustive switch statement of the parameter combinations: switch (data, ulrResponse, error) {       case (.some, .some, .some):       case (.some, .some, .none):       case (.some, .none, .some):       case (.some, .none, .none):       case (.none, .some, .some):       case (.none, .none, .some):       case (.none, .some, .none):       case (.none, .none, .none): } Which combinations of values may be provided and which will not? For example, I think it's fair to say that both (.some, .none, .some) and (.some, .none, .none) are invalid because a response would have to be provided in order to receive data to pass to the closure, and the documentation states: If a response from the server is received, regardless of whether the request completes successfully or fails, the response parameter contains that information.
Posted Last updated
.