DistributedTargetInvocationDecoder
protocol · iOS 16.0+ · SDK 27.1
protocol DistributedTargetInvocationDecoder<SerializationRequirement>Decoder that must be provided to `executeDistributedTarget` and is used by the Swift runtime to decode arguments of the invocation. ### Decoding DistributedActor arguments using Codable When using an actor system where `ActorID` is `Codable`, every distributed actor using that system is also implicitly `Codable` (see ``DistributedActorSystem``). Such distributed actors are encoded as their `ActorID` stored in an `Encoder.singlevaluecontainer()`. When `Codable` is being used by such a system, the ``decodeNextArgument()`` method will be using `Decoder` to decode the incoming values, which may themselves be distributed actors. An actor system must be provided to the `Decoder` in order for a distributed actor's `Decodable.init(from:)` to be able to return the instance of the actor. Specifically, the decoded `ActorID` is passed to the actor system's `resolve(id:as:)` method in order to return either a local instance identified by this ID, or creating a remote actor reference. Thus, you must set the actor system the decoding is performed for, on the decoder's `userInfo`, as follows: ``` mutating func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { let argumentData: Data = /// ... // ... decoder.userInfo[.actorSystemKey] = self.actorSystem return try Argument.decode( } ```
Members (0)
This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.
Skipped declarations
No declarations were skipped in this snapshot.