---
title: "subscript(_:)"
framework: foundation
role: symbol
role_heading: Instance Subscript
path: "foundation/attributedstring/subscript(_:)-2yypq"
---

# subscript(_:)

Obtain the discontiguous substring of a selection.

## Declaration

```swift
subscript(selection: AttributedTextSelection) -> DiscontiguousAttributedSubstring { get }
```

## Overview

Overview In the case of an insertion point, this substring is empty. Otherwise, the substring contains all selected characters.
