<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macCatalyst: 18.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "TranslationUIProvider",
  "identifier" : "/documentation/TranslationUIProvider/TranslationUIProviderContext",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "TranslationUIProvider"
    ],
    "preciseIdentifier" : "s:21TranslationUIProvider0aB7ContextP"
  },
  "title" : "TranslationUIProviderContext"
}
-->

# TranslationUIProviderContext

An object that encapsulates the XPC communication between the host process and the third-party extension implementation.

```
protocol TranslationUIProviderContext : Observable
```

## Discussion

The framework provides information to the extension through the two observable properties [`inputText`](/documentation/TranslationUIProvider/TranslationUIProviderContext/inputText) and [`allowsReplacement`](/documentation/TranslationUIProvider/TranslationUIProviderContext/allowsReplacement), and the extension calls back to the host process using the functions [`finish(translation:)`](/documentation/TranslationUIProvider/TranslationUIProviderContext/finish(translation:)) and, optionally [`expandSheet()`](/documentation/TranslationUIProvider/TranslationUIProviderContext/expandSheet()).

## Topics

### Instance Properties

[`var allowsReplacement: Bool`](/documentation/TranslationUIProvider/TranslationUIProviderContext/allowsReplacement)

A Boolean value that indicates whether the control can replace the source text.

[`var inputText: AttributedString?`](/documentation/TranslationUIProvider/TranslationUIProviderContext/inputText)

The source text to translate.

### Instance Methods

[`func expandSheet()`](/documentation/TranslationUIProvider/TranslationUIProviderContext/expandSheet())

The framework requests that the sheet expand.

[`func finish(translation: AttributedString?)`](/documentation/TranslationUIProvider/TranslationUIProviderContext/finish(translation:))

Completes the translation after which the framework closes the sheet.

## Relationships

### Inherits From

[`Observable`](/documentation/Observation/Observable)

---

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)