<!--
{
  "documentType" : "article",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/MainActor/Actor-Implementations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Actor Implementations"
}
-->

# Actor Implementations

## Topics

### Instance Methods

[`func assertIsolated(@autoclosure () -> String, file: StaticString, line: UInt)`](/documentation/Swift/MainActor/assertIsolated(_:file:line:))

Stops program execution if the current task is not executing on this
actor’s serial executor.

[`func assumeIsolated<T>((isolated Self) throws -> T, file: StaticString, line: UInt) rethrows -> T`](/documentation/Swift/MainActor/assumeIsolated(_:file:line:)-swift.method)

Assume that the current task is executing on this actor’s serial executor,
or stop program execution otherwise.

[`func preconditionIsolated(@autoclosure () -> String, file: StaticString, line: UInt)`](/documentation/Swift/MainActor/preconditionIsolated(_:file:line:))

Stops program execution if the current task is not executing on this
actor’s serial executor.

[`func withSerialExecutor<T, E>((any SerialExecutor) throws(E) -> T) throws(E) -> T`](/documentation/Swift/MainActor/withSerialExecutor(_:)-79jll)

Perform an operation with the actor’s [`SerialExecutor`](/documentation/Swift/SerialExecutor).

[`func withSerialExecutor<T, E>(nonisolated(nonsending) (any SerialExecutor) async throws(E) -> T) async throws(E) -> T`](/documentation/Swift/MainActor/withSerialExecutor(_:)-epjy)

Perform an operation with the actor’s [`SerialExecutor`](/documentation/Swift/SerialExecutor).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)