Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions content/docs/(reference)/swift-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ let copy = try await WorkingCopy.open(store: storeURL, server: Server(url: serve
| `Server(url:key:)` | The instance's URL and a key or an app's access token. |
| `Server.fromEnvironment()` | For a command-line tool: reads `MARFA_API_URL` and `MARFA_API_KEY`. Returns `nil` when both are absent, and throws when only one is set or the URL names no server. |

## Identify the connected instance

Use **`Server.instanceDescription()`** to display the connected instance's name. It reads the [public instance description](/api-reference/instance/getInstance) through the core, without sending the key or opening a working copy:

```swift
let server = Server(url: serverURL, key: key)
let instance = try await server.instanceDescription()
print(instance.name)
print(instance.instanceId)
```

The server supplies `Marfa` when no display name is configured. The `InstanceDescription` also holds `version`, optional `release`, `contract` and `features`.

The request preserves the URL's path prefix and needs no `config.manage` permission. **A failed read throws `MarfaError`**, rather than inventing a name. Reading the description does not establish access to the instance's data or contract compatibility.

## Keep the copy in step

Your app decides when the copy talks to the instance:
Expand Down
Loading