<!--
{
  "availability" : [
    "tvOS: 13.0.0 - 18.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "TVMLKit",
  "identifier" : "/documentation/TVMLKit/TVDocumentViewController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "TVMLKit"
    ],
    "preciseIdentifier" : "c:objc(cs)TVDocumentViewController"
  },
  "title" : "TVDocumentViewController"
}
-->

# TVDocumentViewController

A view controller that represents a TVMLKit document.

```
class TVDocumentViewController
```

## Overview

Instances of this class serve as bridges into `TVMLKit JS`’s document life cycle, and allow for native event handling with `TVMLKit`. This class also provides a way for native clients to communicate with `TVMLKit JS`.

## Topics

### Initializing the Document View Controller

[`convenience init(context: [String : Any], for: TVApplicationController)`](/documentation/TVMLKit/TVDocumentViewController/init(context:for:))

Creates a new document view controller with a specific context and app controller.

### Managing Interactions with the Document

[`var delegate: (any TVDocumentViewControllerDelegate)?`](/documentation/TVMLKit/TVDocumentViewController/delegate)

The delegate for handling events in the document view controller.

[`protocol TVDocumentViewControllerDelegate`](/documentation/TVMLKit/TVDocumentViewControllerDelegate)

Methods to manage updates, events, and errors from the document view controller.

### Handling Document Events

[`struct Event`](/documentation/TVMLKit/TVDocumentViewController/Event)

Events that can be triggered on the document view controller.

### Updating the Document View Controller

[`func update(using: [String : Any])`](/documentation/TVMLKit/TVDocumentViewController/update(using:))

Updates the document view controller with the provided context.

### Accessing the Document’s Components

[`var appController: TVApplicationController?`](/documentation/TVMLKit/TVDocumentViewController/appController)

The document’s app controller that bridges UI, navigation stack, storage, and event handling from JavaScript.

[`var documentContext: [String : Any]`](/documentation/TVMLKit/TVDocumentViewController/documentContext)

The current document context.

## Relationships

### Conforms To

[`UIStateRestoring`](/documentation/UIKit/UIStateRestoring)

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

[`UIContentContainer`](/documentation/UIKit/UIContentContainer)

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

[`UITraitChangeObservable-67e94`](/documentation/UIKit/UITraitChangeObservable-67e94)

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

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

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

[`UITraitEnvironment`](/documentation/UIKit/UITraitEnvironment)

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

[`UIUserActivityRestoring`](/documentation/UIKit/UIUserActivityRestoring)

[`UIAppearanceContainer`](/documentation/UIKit/UIAppearanceContainer)

[`UIActivityItemsConfigurationProviding`](/documentation/UIKit/UIActivityItemsConfigurationProviding)

[`UIResponderStandardEditActions`](/documentation/UIKit/UIResponderStandardEditActions)

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

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

[`UIFocusEnvironment`](/documentation/UIKit/UIFocusEnvironment)

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

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

### Inherits From

[`UIViewController`](/documentation/UIKit/UIViewController)

---

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)