Back to Developer Roadmap

Subscripts

src/data/roadmaps/swift-ui/content/[email protected]

4.01.0 KB
Original Source

Subscripts

Subscripts are shortcuts for accessing elements within a collection, list, or sequence. They allow you to query instances of a type by writing one or more values in square brackets after the instance name. You can define subscripts on classes, structures, and enumerations, and they can take a single parameter or multiple parameters of any type. Subscripts make it possible to access and set values using a familiar syntax, similar to how you access elements in an array or dictionary.

Visit the following resources to learn more: