diff --git a/content/docs/(reference)/swift-sdk.mdx b/content/docs/(reference)/swift-sdk.mdx index 061a9633..6c116ee7 100644 --- a/content/docs/(reference)/swift-sdk.mdx +++ b/content/docs/(reference)/swift-sdk.mdx @@ -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: