---
title: "Implicit Request Contexts"
url: https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/implicit-request-contexts
language: swift
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Implicit Request Contexts

Programming language: Swift. Other languages: [C++](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/implicit-request-contexts/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/implicit-request-contexts/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/implicit-request-contexts/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/implicit-request-contexts/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/implicit-request-contexts/matlab.md), [Python](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/implicit-request-contexts/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/implicit-request-contexts/ruby.md).

An implicit request context belongs to a communicator: Ice sends it with each invocation made through the proxies of this communicator, unless the invocation has an [explicit context](https://docs.zeroc.com/ice/3.8/runtime/invocation/request-contexts/explicit-request-contexts/swift.md).

## Configuring the Implicit Context

The [Ice.ImplicitContext](https://docs.zeroc.com/ice/3.8/property-reference/ice-properties/swift.md#ice.implicitcontext) property specifies whether the communicator has an implicit context:

- `None` *(the default)*: the communicator has no implicit context.
- `Shared`: the communicator has one implicit context, which all threads can use concurrently.
- `PerThread`: the communicator has a separate implicit context for each thread.

## Using the Implicit Context

`getImplicitContext` on the communicator returns its implicit context, an object with methods to read and update the context's entries. With `PerThread`, call `getImplicitContext` and update the context on the thread that makes the invocations.

> **Warning**
>
> `PerThread` is not usable in code that makes invocations with `await`: this code can resume on a different thread, with a different implicit context, after each `await`.

```swift
let implicitContext = communicator.getImplicitContext()!
implicitContext.put(key: "language", value: "fr")

// This invocation sends the "language" entry of the implicit context.
let greeting = try await greeter.greet(name)
```
