# Swift API reference

Source: https://libtmux.org/en/swift/latest/reference/

> Types, methods, and functions in libtmux for Swift.

Swift API

1106 symbols, extracted from source. Every type name in a signature links to its own entry; every cross-reference in a doc comment resolves against the same table.

Server 4 types

[DiscoveredServer 6 members](https://libtmux.org/en/swift/latest/reference/discoveredserver/)

A tmux server found listening on a socket.

[ServerDiscovery 4 members](https://libtmux.org/en/swift/latest/reference/serverdiscovery/)

The bounded result of scanning for tmux servers.

[ServerIncarnation 7 members](https://libtmux.org/en/swift/latest/reference/serverincarnation/)

The identity of one running tmux daemon at one endpoint.

[Server 106 members](https://libtmux.org/en/swift/latest/reference/server/)

A tmux server, addressed by its endpoint.

Session 2 types

[SessionID 12 members](https://libtmux.org/en/swift/latest/reference/sessionid/)

A tmux session id such as `$1`.

[Session 13 members](https://libtmux.org/en/swift/latest/reference/session/)

A tmux session, as it was when the listing was read.

Window 6 types

[WindowPlacement 4 members](https://libtmux.org/en/swift/latest/reference/windowplacement/)

Where a new window goes relative to one that is already there.

[WindowID 12 members](https://libtmux.org/en/swift/latest/reference/windowid/)

A tmux window id such as `@1`.

[WindowLinkID 6 members](https://libtmux.org/en/swift/latest/reference/windowlinkid/)

The session-local identity of one link to a window.

[Window 13 members](https://libtmux.org/en/swift/latest/reference/window/)

One tmux window, independent of every session that links it.

[WindowLink 10 members](https://libtmux.org/en/swift/latest/reference/windowlink/)

One session-local link to a window.

[WindowAppearance 4 members](https://libtmux.org/en/swift/latest/reference/windowappearance/)

One window and one session-local appearance, read from the same tmux reply.

Pane 4 types

[PaneDirection 6 members](https://libtmux.org/en/swift/latest/reference/panedirection/)

Where a split puts the pane it creates.

[PaneSize 4 members](https://libtmux.org/en/swift/latest/reference/panesize/)

How big a split makes the pane it creates.

[PaneID 12 members](https://libtmux.org/en/swift/latest/reference/paneid/)

A tmux pane id such as `%1`.

[Pane 24 members](https://libtmux.org/en/swift/latest/reference/pane/)

A tmux pane, as it was when the listing was read.

Client 1 type

[Client 18 members](https://libtmux.org/en/swift/latest/reference/client/)

A client attached to a tmux server.

Hooks 2 types

[HookScope 4 members](https://libtmux.org/en/swift/latest/reference/hookscope/)

Which of tmux's hook tables a hook lives in.

[TmuxHook 7 members](https://libtmux.org/en/swift/latest/reference/tmuxhook/)

One tmux hook: a command tmux runs when something happens.

Options 2 types

[OptionScope 8 members](https://libtmux.org/en/swift/latest/reference/optionscope/)

The exact tmux table that owns an option.

[TmuxOption 7 members](https://libtmux.org/en/swift/latest/reference/tmuxoption/)

One tmux option.

Buffers 1 type

[TmuxBuffer 6 members](https://libtmux.org/en/swift/latest/reference/tmuxbuffer/)

One of the server's paste buffers.

Layout and geometry 1 type

[ResizeDirection 6 members](https://libtmux.org/en/swift/latest/reference/resizedirection/)

Which way a resize moves the boundary a pane shares with its neighbour.

Environment 2 types

[EnvironmentScope 4 members](https://libtmux.org/en/swift/latest/reference/environmentscope/)

Which environment a variable lives in.

[TmuxEnvironmentVariable 6 members](https://libtmux.org/en/swift/latest/reference/tmuxenvironmentvariable/)

One variable in a tmux environment.

Versions 1 type

[TmuxVersion 17 members](https://libtmux.org/en/swift/latest/reference/tmuxversion/)

A tmux release, ordered the way tmux numbers them.

Commands 3 types

[TmuxCommandList 7 members](https://libtmux.org/en/swift/latest/reference/tmuxcommandlist/)

Several tmux commands sent in one invocation.

[TmuxCommand 4 members](https://libtmux.org/en/swift/latest/reference/tmuxcommand/)

One tmux command, as argv.

[TmuxShellCommand 9 members](https://libtmux.org/en/swift/latest/workspace/reference/tmuxshellcommand/)

A command to put in a pane, and whether to run it.

Control mode 4 types, 1 function or constant

[ControlReply 5 members](https://libtmux.org/en/swift/latest/reference/controlreply/)

One command's reply, framed between tmux's `%begin` and its terminator.

[ControlNotification 4 members](https://libtmux.org/en/swift/latest/reference/controlnotification/)

Something tmux said without being asked.

[ControlSession 8 members](https://libtmux.org/en/swift/latest/reference/controlsession/)

A live control-mode connection.

[ControlNotificationStream 18 members](https://libtmux.org/en/swift/latest/reference/controlnotificationstream/)

One observer's control notifications with finite pending storage.

* SubscriptionChangeStream : typealias [SubscriptionChangeStream](https://libtmux.org/en/swift/latest/reference/subscriptionchangestream/ "SubscriptionChangeStream")

  typealias \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/Watch.swift#L131)] [¶](#SubscriptionChangeStream "Permalink to SubscriptionChangeStream")

  typealias \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/Watch.swift#L131)] [¶](#SubscriptionChangeStream "Permalink to SubscriptionChangeStream")

  SubscriptionChangeStream

  A lazy view of subscription changes from one bounded notification observer.

Formats 1 type

[FormatSubscription 6 members](https://libtmux.org/en/swift/latest/reference/formatsubscription/)

A format tmux reports changes to, rather than being asked for.

Queries 6 types, 3 functions and constants

[FilterValue 5 members](https://libtmux.org/en/swift/latest/reference/filtervalue/)

A value a filter can compare against.

[Filterable 4 members](https://libtmux.org/en/swift/latest/reference/filterable/)

A model that can be filtered declaratively.

[FilterOperation 10 members](https://libtmux.org/en/swift/latest/reference/filteroperation/)

How a filter compares one field.

[FilterLookup 1 members](https://libtmux.org/en/swift/latest/reference/filterlookup/)

Builds a filter from a `field__operator=value` lookup written as text.

[FilterSchema 10 members](https://libtmux.org/en/swift/latest/reference/filterschema/)

The filtering vocabulary, as a document.

[RelationQuery 5 members](https://libtmux.org/en/swift/latest/reference/relationquery/)

A quantified filter over a relation, as one value.

* exactlyOne(\_:) ( *expression : [FilterExpr](https://libtmux.org/en/swift/latest/reference/filterexpr/ "FilterExpr")\<Element>&#x20;*) → Self.Element

  method \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/FilterExpr.swift#L347)] [¶](#Sequence.exactlyOne\(_:\) "Permalink to exactlyOne(_:)")

  method \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/FilterExpr.swift#L347)] [¶](#Sequence.exactlyOne\(_:\) "Permalink to exactlyOne(_:)")

  exactlyOne(\_:)

  The one element the filter matches.

  Distinguishes "nothing matched" from "several matched", because a caller that meant to address one object needs to know which mistake it made.

  * Raises

    * [FilterSelectionError](https://libtmux.org/en/swift/latest/reference/filterselectionerror/ "FilterSelectionError")

- filter(\_:) ( *expression : [FilterExpr](https://libtmux.org/en/swift/latest/reference/filterexpr/ "FilterExpr")\<Element>&#x20;*) → \[Self.Element]

  method \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/FilterExpr.swift#L326)] [¶](#Sequence.filter\(_:\) "Permalink to filter(_:)")

  method \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/FilterExpr.swift#L326)] [¶](#Sequence.filter\(_:\) "Permalink to filter(_:)")

  filter(\_:)

  Every element the filter matches, in order.

  Returns a plain array: ordered, replayable, and free of any live connection to tmux.

  * Raises

    * [RegexMatchError](https://libtmux.org/en/swift/latest/reference/regexmatcherror/ "RegexMatchError")

* oneOrNil(\_:) ( *expression : [FilterExpr](https://libtmux.org/en/swift/latest/reference/filterexpr/ "FilterExpr")\<Element>&#x20;*) → Self.Element?

  method \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/FilterExpr.swift#L366)] [¶](#Sequence.oneOrNil\(_:\) "Permalink to oneOrNil(_:)")

  method \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/FilterExpr.swift#L366)] [¶](#Sequence.oneOrNil\(_:\) "Permalink to oneOrNil(_:)")

  oneOrNil(\_:)

  The one element the filter matches, or `nil` if none did.

  Only ambiguity is an error here; absence is an ordinary answer.

  * Raises

    * [FilterSelectionError](https://libtmux.org/en/swift/latest/reference/filterselectionerror/ "FilterSelectionError")

Queries — Operators 2 types

[FilterOperator 8 members](https://libtmux.org/en/swift/latest/reference/filteroperator/)

A typed operator. The `Value` it is built for is the projected type of the key path it is paired with, so pairing a text operator with an integer field is a compile error rather than a runtime surprise.

[RelationQuantifier 9 members](https://libtmux.org/en/swift/latest/reference/relationquantifier/)

How many related objects have to match.

Queries — Expressions 1 type

[FilterExpr 9 members](https://libtmux.org/en/swift/latest/reference/filterexpr/)

A filter over one model, held as data.

Snapshots 4 types

[CaptureCursor 3 members](https://libtmux.org/en/swift/latest/reference/capturecursor/)

Where a previous read of a pane stopped.

[IncrementalCapture 8 members](https://libtmux.org/en/swift/latest/reference/incrementalcapture/)

What a pane has said since a cursor was taken.

[PaneCapture 4 members](https://libtmux.org/en/swift/latest/reference/panecapture/)

A bounded read of a pane.

[Snapshot 26 members](https://libtmux.org/en/swift/latest/reference/snapshot/)

Every object read from one daemon incarnation.

Errors 12 types, 1 function or constant

[QueryConstructionError 4 members](https://libtmux.org/en/swift/latest/reference/queryconstructionerror/)

Why a filter could not be built.

[FilterValidationError 4 members](https://libtmux.org/en/swift/latest/reference/filtervalidationerror/)

Why a decoded filter cannot be evaluated safely.

[FilterSelectionError 4 members](https://libtmux.org/en/swift/latest/reference/filterselectionerror/)

Why selecting one result from a filter failed.

[FilterLookupError 8 members](https://libtmux.org/en/swift/latest/reference/filterlookuperror/)

Why a filter keyword could not be turned into a comparison.

[FilteredListingError 4 members](https://libtmux.org/en/swift/latest/reference/filteredlistingerror/)

Why a filtered listing failed.

[RegexCompileError 14 members](https://libtmux.org/en/swift/latest/reference/regexcompileerror/)

Why a [`RegexPattern` ](https://libtmux.org/en/swift/latest/reference/regexpattern/)could not be compiled.

[RegexMatchError 5 members](https://libtmux.org/en/swift/latest/reference/regexmatcherror/)

Why a compiled [`RegexPattern` ](https://libtmux.org/en/swift/latest/reference/regexpattern/)could not finish matching.

[TmuxError 18 members](https://libtmux.org/en/swift/latest/reference/tmuxerror/)

Everything a tmux operation can fail with.

[FormatDecodingError 5 members](https://libtmux.org/en/swift/latest/reference/formatdecodingerror/)

A tmux reply that did not match its projection.

[CardinalityError 4 members](https://libtmux.org/en/swift/latest/reference/cardinalityerror/)

Why a lookup that expected exactly one match did not get one.

[OutputWaitError 4 members](https://libtmux.org/en/swift/latest/reference/outputwaiterror/)

Why waiting for pane output failed before it produced an outcome.

[WorkspaceBuilderError 7 members](https://libtmux.org/en/swift/latest/workspace/reference/workspacebuildererror/)

Why a workspace could not be built, including what happened while undoing.

* withTmuxError(\_:) ( *body : () async throws -> [Result](https://developer.apple.com/documentation/swift/result "Result (external)")&#x20;*) → [Result](https://developer.apple.com/documentation/swift/result "Result (external)")

  functionasync \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/TypedErrorScope.swift#L40)] [¶](#withTmuxError\(_:\) "Permalink to withTmuxError(_:)")

  functionasync \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/TypedErrorScope.swift#L40)] [¶](#withTmuxError\(_:\) "Permalink to withTmuxError(_:)")

  withTmuxError(\_:)

  Narrowing a scope's thrown type back to [`TmuxError` ](https://libtmux.org/en/swift/latest/reference/tmuxerror/).

  Every call in this library throws [`TmuxError` ](https://libtmux.org/en/swift/latest/reference/tmuxerror/)and says so, which lets a program write `throws(TmuxError)` from top to bottom. The scoped forms — `Server/using(_:_:)`, `Server/connected(attachingTo:_:)` and `Server/withControlMode(attachingTo:_:)` — are the exception: they take a closure, and a closure's thrown type cannot be carried out of one.

  That is a property of the language rather than a choice made here. Swift 6.2 does not infer a closure literal's thrown type from its body, so a `throws(TmuxError)` overload of those scopes is unreachable without spelling the closure's own signature at every call site — and even with the type inferred, a scope that can fail on its own behalf has no way to rethrow that failure as the body's error, because there is no union of the two.

  So the narrowing happens at the boundary instead of inside the scope:

  One wrapper per scope, rather than an annotation per closure.

  * Important: This is for work that only fails with [`TmuxError` ](https://libtmux.org/en/swift/latest/reference/tmuxerror/). Anything else `body` throws is flattened into `TmuxError/invocationFailed(reason:)` with its description as the reason, which keeps the signature honest but loses the original type. A body that throws errors of its own should stay untyped and be caught as itself.
  * Parameter body: the work to run, typically a scoped call.
  * Returns: whatever `body` returned.
  * Throws: [`TmuxError` ](https://libtmux.org/en/swift/latest/reference/tmuxerror/), either as thrown or as a flattened foreign error.

  Examples

  ```swift
  func names(_ server: Server) async throws(TmuxError) -> [String] {
      try await withTmuxError {
          try await server.using(.connected(to: "main")) { server in
              try await server.sessions().map(\.name)
          }
      }
  }
  ```

  * Raises

    * [Result](https://developer.apple.com/documentation/swift/result "Result (external)")

Constants and enums 1 type

[TmuxMode 3 members](https://libtmux.org/en/swift/latest/reference/tmuxmode/)

How work reaches tmux.

Testing utilities 2 types, 8 functions and constants

[NamedSocketRootMissing 2 members](https://libtmux.org/en/swift/latest/reference/namedsocketrootmissing/)

Thrown when a name-addressed case runs without a directory to put it in.

[UnsafeReaperRoot 4 members](https://libtmux.org/en/swift/latest/reference/unsafereaperroot/)

The reaper was asked to remove a path outside this port's owned roots.

* namedSocketRoot : let [namedSocketRoot](https://libtmux.org/en/swift/latest/reference/namedsocketroot/ "namedSocketRoot"): URL?

  constant \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L167)] [¶](#namedSocketRoot "Permalink to namedSocketRoot")

  constant \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L167)] [¶](#namedSocketRoot "Permalink to namedSocketRoot")

  namedSocketRoot

  The directory a socket \*name\* resolves inside, when the run provides one.

  tmux looks a name up in `TMUX_TMPDIR`, whose default is shared with every other tmux on the machine — the other libtmux ports' included. A suite that addressed servers by name without moving that directory would put its sockets exactly where anything sweeping by prefix can reach them, which is what this whole root exists to prevent.

  So the directory is taken from the environment rather than set into it. The obvious alternative — `setenv` from the fixture — writes to `environ` while other cases are concurrently reading it to build a tmux environment, and that is a data race whether or not it has bitten yet. Cases that address a socket by path do not care either way, `-S` being absolute.

  `CONTRIBUTING.md` and CI name the directory; [`namedSocketsAvailable` ](https://libtmux.org/en/swift/latest/reference/namedsocketsavailable/)is what the suite checks so a run without one skips those cases rather than scattering sockets.

- namedSocketsAvailable : var [namedSocketsAvailable](https://libtmux.org/en/swift/latest/reference/namedsocketsavailable/ "namedSocketsAvailable"): [Bool](https://developer.apple.com/documentation/swift/bool "Bool (external)")

  constant \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L177)] [¶](#namedSocketsAvailable "Permalink to namedSocketsAvailable")

  constant \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L177)] [¶](#namedSocketsAvailable "Permalink to namedSocketsAvailable")

  namedSocketsAvailable

  Whether this run can address servers by socket name inside the suite's root.

* reaperCommand(root:) ( *root : URL&#x20;*) → [TmuxCommand](https://libtmux.org/en/swift/latest/reference/tmuxcommand/ "TmuxCommand")

  function \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L306)] [¶](#reaperCommand\(root:\) "Permalink to reaperCommand(root:)")

  function \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L306)] [¶](#reaperCommand\(root:\) "Permalink to reaperCommand(root:)")

  reaperCommand(root:)

  A reaper that outlives this process, so a killed run leaves no server behind.

  Arm it in the same invocation that creates the server's first session, and give it the directory holding the socket. Public because the benchmark provisions its own servers — with a counting shim standing in for tmux — and a second copy of this reasoning is a second copy to get wrong.

  `defer` and `kill-server` both run \*in the process that started the server\*, which makes them useless in the one case that actually leaks: the run is killed outright by a harness timeout or an impatient operator, and every tmux server it started survives with no owner and no way to reach it. Cleanup that depends on the cleaner surviving is not deterministic.

  So the reaper lives inside the tmux server instead, as a background job. It watches the owning process and, once that is gone, removes the directory and kills the server. Three details carry the design:

  * The directory goes first. `kill` ends the server, and tmux kills its jobs when it exits, so anything sequenced after it would not run.
  * The server is addressed by pid, not by socket, because the socket is inside the directory just removed.
  * `#{pid}` is left for tmux to expand rather than asked for first, which is what lets arming ride in the same invocation that creates the session. Sent separately, a run killed in the gap between the two leaves a server no reaper ever covered — measurably, under load, about one server in six.
  * The interval is whole seconds. Fractions are a GNU and BSD extension that POSIX does not require, and a `sleep` that rejects its argument turns this into a busy loop per server rather than a slower one. Reaping a second later costs nothing here.

  - Raises

    * [UnsafeReaperRoot](https://libtmux.org/en/swift/latest/reference/unsafereaperroot/ "UnsafeReaperRoot")

- tmuxExecutablePath() ( ) → [String](https://developer.apple.com/documentation/swift/string "String (external)")

  function \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L344)] [¶](#tmuxExecutablePath\(\) "Permalink to tmuxExecutablePath()")

  function \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L344)] [¶](#tmuxExecutablePath\(\) "Permalink to tmuxExecutablePath()")

  tmuxExecutablePath()

  The lane binary when a matrix runner selected one, otherwise whatever `tmux` resolves to. Resolved to a path because the transport never searches `PATH`.

* waitForShellPrompt(on:within:) ( *on : [Server](https://libtmux.org/en/swift/latest/reference/server/ "Server")&#x20;*, *within : [Duration](https://developer.apple.com/documentation/swift/duration "Duration (external)")&#x20;*) → ()

  functionasync \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L133)] [¶](#waitForShellPrompt\(on:within:\) "Permalink to waitForShellPrompt(on:within:)")

  functionasync \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L133)] [¶](#waitForShellPrompt\(on:within:\) "Permalink to waitForShellPrompt(on:within:)")

  waitForShellPrompt(on:within:)

  Waits until a pane's shell has drawn its first prompt.

  Keys sent before that are echoed with no prompt in front of them, which leaves the prompt to land on the row the command's own output wants. A case looking for a row equal to what it printed is then waiting for something that cannot arrive, and reports it as a timeout naming nothing. One capture settles it for every case that follows.

  What the prompt \*says\* is not portable — `sh` is dash on Linux and bash on macOS, which prints `sh-3.2$` — so readiness is that the pane has drawn anything at all. Until the shell starts it has drawn nothing.

  This reads the pane directly rather than through the wait machinery: a fixture that bootstrapped itself with the code under test would make every unrelated case depend on it.

- waitUntil(within:\_:) ( *within : [Duration](https://developer.apple.com/documentation/swift/duration "Duration (external)")&#x20;*, *condition : () async throws -> [Bool](https://developer.apple.com/documentation/swift/bool "Bool (external)")&#x20;*) → [Bool](https://developer.apple.com/documentation/swift/bool "Bool (external)")

  functionasync \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L328)] [¶](#waitUntil\(within:_:\) "Permalink to waitUntil(within:_:)")

  functionasync \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L328)] [¶](#waitUntil\(within:_:\) "Permalink to waitUntil(within:_:)")

  waitUntil(within:\_:)

  Polls `condition` until it holds, and reports whether it did.

  Bounded in wall-clock rather than in attempts. What makes one of these polls slow is the tmux call inside it, so a count of attempts says nothing about how long the loop can run: on a contended machine a generous-looking budget outlives the case's time limit, and the failure reads as a timeout instead of naming the thing that never became true.

  * Raises

    * [Bool](https://developer.apple.com/documentation/swift/bool "Bool (external)")

  Discussed in [Waiting and retrying](https://libtmux.org/en/topics/waiting-and-retry/)

* withNamedTmuxServer(\_:) ( *body : ([Server](https://libtmux.org/en/swift/latest/reference/server/ "Server")) async throws -> [Result](https://developer.apple.com/documentation/swift/result "Result (external)")&#x20;*) → [Result](https://developer.apple.com/documentation/swift/result "Result (external)")

  functionasync \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L195)] [¶](#withNamedTmuxServer\(_:\) "Permalink to withNamedTmuxServer(_:)")

  functionasync \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L195)] [¶](#withNamedTmuxServer\(_:\) "Permalink to withNamedTmuxServer(_:)")

  withNamedTmuxServer(\_:)

  Runs `body` against a private tmux server addressed by socket \*name\*, and always kills it.

  The same guarantees as `withTmuxServer(_:)` — its own server, killed on the way out and reaped if this process is killed outright — for the half of [`Endpoint` ](https://libtmux.org/en/swift/latest/reference/endpoint/)that a path-addressed fixture never exercises.

  * Raises

    * [Result](https://developer.apple.com/documentation/swift/result "Result (external)")

- withTmuxServer(socketFileName:\_:) ( *socketFileName : [String](https://developer.apple.com/documentation/swift/string "String (external)")&#x20;*, *body : ([Server](https://libtmux.org/en/swift/latest/reference/server/ "Server")) async throws -> [Result](https://developer.apple.com/documentation/swift/result "Result (external)")&#x20;*) → [Result](https://developer.apple.com/documentation/swift/result "Result (external)")

  functionasync \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L48)] [¶](#withTmuxServer\(socketFileName:_:\) "Permalink to withTmuxServer(socketFileName:_:)")

  functionasync \[[source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Tests/TmuxFixture/TmuxFixture.swift#L48)] [¶](#withTmuxServer\(socketFileName:_:\) "Permalink to withTmuxServer(socketFileName:_:)")

  withTmuxServer(socketFileName:\_:)

  Runs `body` against a private tmux server and always kills it — including when this process is killed outright.

  Each case gets its own socket, so cases never see each other's sessions and teardown never touches a server it did not start. The server is bootstrapped with one session named `bootstrap`: a tmux server exits as soon as its last session goes away, so without one there is nothing to hold it open. Scope assertions to the objects the case created rather than to the server being otherwise empty.

  * Raises

    * [Result](https://developer.apple.com/documentation/swift/result "Result (external)")

  Discussed in [Use the Swift workspace builder](https://libtmux.org/en/swift/latest/workspace/internals/guides/)

Other 8 types

[TmuxServers 2 members](https://libtmux.org/en/swift/latest/reference/tmuxservers/)

Finding the tmux servers already running on this machine.

[Endpoint 7 members](https://libtmux.org/en/swift/latest/reference/endpoint/)

Where a tmux server listens.

[RegexUnsupportedConstruct 9 members](https://libtmux.org/en/swift/latest/reference/regexunsupportedconstruct/)

A regular-expression feature this package deliberately does not execute.

[RegexPattern 16 members](https://libtmux.org/en/swift/latest/reference/regexpattern/)

A compiled regular expression with bounded memory and matching work.

[TmuxReply 8 members](https://libtmux.org/en/swift/latest/reference/tmuxreply/)

What tmux said.

[TmuxContext 9 members](https://libtmux.org/en/swift/latest/reference/tmuxcontext/)

Where the tmux this process is running inside can be found.

[OutputWait 12 members](https://libtmux.org/en/swift/latest/reference/outputwait/)

What a wait on a pane's output ended on.

[SubscriptionChange 10 members](https://libtmux.org/en/swift/latest/reference/subscriptionchange/)

One report that a subscribed format's value changed.
