# Workspace.decode(yaml:)

- **Module:** Workspace
- **Package:** TmuxWorkspace
- **Language:** Swift
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/TmuxWorkspace/Workspace.swift#L57
- **Page:** https://libtmux.org/en/swift/latest/workspace/reference/workspace-decode(yaml-)/

```
Workspace.decode(yaml:)(yaml: String) -> Workspace
```

Reads a workspace from YAML, which is how tmuxp files are usually written.

Available when the `YAMLWorkspaces` trait is enabled, which is what
pulls in the YAML parser:

## Raises

- `Workspace`

## Example

```swift
.package(
    url: "https://github.com/libtmux/libtmux-swift.git",
    exact: "0.1.0-alpha.5",
    traits: ["YAMLWorkspaces"]
)
```
