asLocalActor
Produces an erased any Actor reference to this known to be local distributed actor.
Declaration
@backDeployed(before: macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0)
var asLocalActor: any Actor { get }Discussion
Since this method is not distributed, it can only be invoked when the underlying distributed actor is known to be local, e.g. from a context that is isolated to this actor.
Such reference can be used to work with APIs accepting isolated any Actor, as only a local distributed actor can be isolated on and may be automatically erased to such any Actor when calling methods implicitly accepting the caller’s actor isolation, e.g. by using the #isolation macro.