<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/AttributedString/rangeOfAudioTimeRangeAttributes(intersecting:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation16AttributedStringV6SpeechE31rangeOfAudioTimeRangeAttributes12intersectingSnyAC5IndexVGSgSo06CMTimeI0a_tF"
  },
  "title" : "rangeOfAudioTimeRangeAttributes(intersecting:)"
}
-->

# rangeOfAudioTimeRangeAttributes(intersecting:)

Returns the range of the attributed string that is within the given time range.

```
func rangeOfAudioTimeRangeAttributes(intersecting timeRange: CMTimeRange) -> Range<AttributedString.Index>?
```

## Parameters

`timeRange`

An audio time range.

## Return Value

The range of the string’s intersecting text, or `nil` if the string has no intersecting text.

## Discussion

The method compares the given time range against the [`AttributeScopes.SpeechAttributes.TimeRangeAttribute`](/documentation/Foundation/AttributeScopes/SpeechAttributes/TimeRangeAttribute) attributes of the string. The time ranges in the string should be in ascending order, but not necessarily contiguous, and the string can include runs without a time range attribute.

You can use this method to help update an attributed string that tracks the volatile or finalized results of a `SpeechTranscriber` or `DictationTranscriber` module.

---

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)