Gold Challenge

This challenge is unique in that it does not have a specific problem or solution. Instead, it is an encouragement to spend some time reading interfaces written by the Swift team at Apple.

You first encountered the map(_:) method in Chapter 13, where you called it on arrays. Then in Chapter 19, you called map(_:) on a range constructed with the ..< operator. Both of these were actually calling map(_:) methods defined in protocol extensions by the Swift standard library.

The Swift standard library contains a large number of properties and methods provided by protocol extensions. Many of them also include where clauses that restrict their use based on various criteria.

Remember that you can Command-click on a type, ...

Get Swift Programming: The Big Nerd Ranch Guide 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.