> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clickterm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ClicktermDialog

> Display clickwrap agreements and previously accepted content in the ClickTerm iOS SDK.

`ClicktermDialog` presents the ClickTerm agreement UI from a visible `UIViewController`.

## Show a clickwrap

```swift theme={null}
@MainActor
ClicktermDialog.show(
    from presenter: UIViewController,
    request: ClickwrapTemplateRequest
) async throws -> String?
```

Create the request and present the dialog:

```swift theme={null}
import ClicktermSDK
import UIKit

let request = ClickwrapTemplateRequest(
    clickwrapTemplateId: "YOUR_TEMPLATE_ID",
    endUserId: "user-123",
    templatePlaceholders: [
        "fullName": AnyCodable("Alice Example"),
        "email": AnyCodable("alice@example.com"),
        "customPlaceholders": AnyCodable([
            "plan": "Enterprise"
        ])
    ],
    language: "en"
)

Task { @MainActor in
    do {
        let signature = try await ClicktermDialog.show(
            from: self,
            request: request
        )

        if let signature {
            // Send the Signature to your backend for verification.
            print("Signature: \(signature)")
        } else {
            // The user already acted on this agreement.
            print("No new action needed.")
        }
    } catch ClicktermError.userCancelled {
        print("The user closed the dialog.")
    } catch {
        print("Could not show the clickwrap: \(error.localizedDescription)")
    }
}
```

### Results

| Outcome                            | Result                                |
| ---------------------------------- | ------------------------------------- |
| User accepts or declines           | Returns a Signature string            |
| An existing Signature is available | Returns that Signature                |
| No new action is needed            | Returns `nil`                         |
| User closes the dialog             | Throws `ClicktermError.userCancelled` |
| Loading or validation fails        | Throws a `ClicktermError`             |

<Note>
  Verify every non-null Signature on your backend before treating the result as
  trusted. See [Verifying a Signature](/dev/guides/verifying-signature).
</Note>

## Show previously accepted content

```swift theme={null}
@MainActor
ClicktermDialog.showAcceptedContent(
    from presenter: UIViewController,
    request: ClickwrapAcceptedAgreementRequest
) async throws -> ClickwrapTemplateContent
```

```swift theme={null}
let request = ClickwrapAcceptedAgreementRequest(
    clickwrapTemplateId: "YOUR_TEMPLATE_ID",
    endUserId: "user-123"
)

Task { @MainActor in
    do {
        let content = try await ClicktermDialog.showAcceptedContent(
            from: self,
            request: request
        )
        print("Displayed \(content.title ?? "accepted agreement")")
    } catch {
        print("Could not display accepted content: \(error.localizedDescription)")
    }
}
```

This method only succeeds when accepted content is available for the supplied template and end user.
