<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/DiscontiguousAttributedSubstring",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation32DiscontiguousAttributedSubstringV"
  },
  "title" : "DiscontiguousAttributedSubstring"
}
-->

# DiscontiguousAttributedSubstring

A discontiguous portion of an attributed string.

```
@dynamicMemberLookup struct DiscontiguousAttributedSubstring
```

## Topics

### Instance Properties

[`var base: AttributedString`](/documentation/Foundation/DiscontiguousAttributedSubstring/base)

The underlying attributed string that the discontiguous attributed substring derives from.

[`var characters: DiscontiguousSlice<AttributedString.CharacterView>`](/documentation/Foundation/DiscontiguousAttributedSubstring/characters)

The characters of the discontiguous attributed string, as a view into the underlying string.

[`var runs: AttributedString.Runs`](/documentation/Foundation/DiscontiguousAttributedSubstring/runs)

The attributed runs of the discontiguous attributed string, as a view into the underlying string.

[`var unicodeScalars: DiscontiguousSlice<AttributedString.UnicodeScalarView>`](/documentation/Foundation/DiscontiguousAttributedSubstring/unicodeScalars)

The Unicode scalars of the discontiguous attributed string, as a view into the underlying string.

### Subscripts

[`subscript<K>(K.Type) -> K.Value?`](/documentation/Foundation/DiscontiguousAttributedSubstring/subscript(_:)-1bcls)

Returns an attribute value that corresponds to an attributed string key.

[`subscript(some RangeExpression<AttributedString.Index>) -> DiscontiguousAttributedSubstring`](/documentation/Foundation/DiscontiguousAttributedSubstring/subscript(_:)-6j670)

Returns a discontiguous substring of this discontiguous attributed string using a range to indicate the discontiguous substring bounds.

[`subscript(RangeSet<AttributedString.Index>) -> DiscontiguousAttributedSubstring`](/documentation/Foundation/DiscontiguousAttributedSubstring/subscript(_:)-6p2b)

Returns a discontiguous substring of this discontiguous attributed string using a set of ranges to indicate the discontiguous substring bounds.

[`subscript<K>(dynamicMember _: KeyPath<AttributeDynamicLookup, K>) -> K.Value?`](/documentation/Foundation/DiscontiguousAttributedSubstring/subscript(dynamicMember:)-5i1c9)

Returns an attribute value that a key path indicates.

[`subscript<S>(dynamicMember _: KeyPath<AttributeScopes, S.Type>) -> ScopedAttributeContainer<S>`](/documentation/Foundation/DiscontiguousAttributedSubstring/subscript(dynamicMember:)-89pug)

Returns a scoped attribute container that a key path indicates.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`Copyable`](/documentation/Swift/Copyable)

[`AttributedStringAttributeMutation`](/documentation/Foundation/AttributedStringAttributeMutation)

[`Escapable`](/documentation/Swift/Escapable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`Hashable`](/documentation/Swift/Hashable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)