Contents

Distributed

Build systems that run distributed code across multiple processes and devices.

Overview

Distributed actors share many characteristics with Swift actors, and include additional isolation checks to ensure location transparency and safety in a distributed environment. Similar to how actors make it easier to write concurrent code that’s safe and correct to run on a single computer, distributed actors make it easier to write code that runs across multiple computers.

[Image]

You use three main parts when writing code with distributed actors:

  • Swift language support for actors and distributed actors. For more information, see Concurrency in The Swift Programming Language.

  • The Distributed module, which includes the types and protocols you need to declare and use distribute actors. For example, it has protocols to which distributed actors and distributed actor systems conform, and structures that encapsulate information about calls to a distributed actor.

  • A distributed actor system, also called a cluster runtime, provides an implementation of the DistributedActorSystem protocol and coordinates between the cluster’s nodes. A distributed actor is always part of some distributed actor system; that distributed actor system handles the serialization and networking necessary to perform remote method calls. For local testing, you can use LocalTestingDistributedActorSystem. For production, you can use the distributed actor system from the Swift Distributed Actors library, use another library, or write your own distributed actor system.

Topics

Distributed Actors

Remote Calls

Local Testing

Errors