There's more...

When we created our completion handlers, we gave them two inputs: the successful result (either the repository information or the created issue), or an error if there is a failure. Both these values are optional; one or the other will be nil, and the other has a value. However, this convention is not enforced by the language, and a user of this function will have to consider the possibility that it may not be the case. What should the user of this function do if the fetchRepos function fires the completion handler with non-nil values for both the repository and the error? What if both are nil?

The user of this function, without viewing the function's internal code, can't be sure that this won't happen, which means they may ...

Get Swift 4 Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.