---
title: "init(from:)"
framework: distributed
role: symbol
role_heading: Initializer
path: "distributed/distributedactor/init(from:)"
---

# init(from:)

Initializes an instance of this distributed actor by decoding its id, and passing it to the DistributedActorSystem obtained from decoder.userInfo[actorSystemKey].

## Declaration

```swift
nonisolated init(from decoder: any Decoder) throws
```

## Parameters

- `decoder`: Used to decode the ID of this distributed actor.

## Requires: The decoder must have the ``CodingUserInfoKey/actorSystemKey`` set to

Requires: The decoder must have the ``CodingUserInfoKey/actorSystemKey`` set to the ActorSystem that this actor expects, as it will be used to call resolve(id:using:) on, in order to obtain the instance this initializer should return. note: If the actor system value in decoder.userInfo is missing or mistyped; the ID fails to decode from the passed decoder;
