---
title: "init(_:timeRange:)"
framework: avfoundation
role: symbol
role_heading: Initializer
path: "avfoundation/avcaption/init(_:timerange:)"
---

# init(_:timeRange:)

Creates a caption that contains text and a time range.

## Declaration

```swift
init(_ text: String, timeRange: CMTimeRange)
```

## Parameters

- `text`: The text the caption displays.
- `timeRange`: The range of time when the caption is active.
