flâneur — a map of the web's best reading

The power of subscripts in Swift | Swift by Sundell

swiftbysundell.com · 2,420 words · saved by 1 readers

This article has been archived, as it was published several years ago, so some of its information might now be outdated. For more recent articles, please visit the main article feed. Using subscripting to access elements within various collections, like arrays and dictionaries, is something that’s very common not only in Swift — but in almost all relatively modern programming languages. However, the way subscripting is actually implemented in Swift is both quite unique, and really powerful — as it lets us add subscripting APIs to our own types, just like those found in the standard library. This week, let’s take a look at how subscripting works in Swift, and a few different ways to incorporate it into the way we design APIs — including some brand new capabilities that are being added in Swift 5.1. Arguably the biggest benefit of subscripting is the incredibly lightweight syntax that it gives us at the call site. Rather than having to call specific methods with names that we either need

This article has been archived, as it was published several years ago, so some of its information might now be outdated. For more recent articles, please visit the main article feed . The power of subscripts in Swift subscripts language features the power of Swift 5.0 Published on 18 Aug 2019 Using subscripting to access elements within various collections, like arrays and dictionaries, is something that’s very common not only in Swift — but in almost all relatively modern programming languages. However, the way subscripting is actually implemented in Swift is both quite unique, and really pow

Explore this link on the map →

related reading