# connect

The connect() method for the SurrealDB Swift SDK connects the client to the configured endpoint.

Connects the client to the endpoint it was configured with.

```swift title="Method Syntax"
try await client.connect()
```

## Example usage

```swift
let client = try SurrealHTTPClient(endpoint: "http://localhost:8000")
try await client.connect()
defer { Task { await client.close() } }
```

See [Connecting to SurrealDB](/docs/reference/swift/concepts/connecting.md) for the available client types and configuration options.
