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

# Overview

> Complete reference documentation for the Encore iOS SDK

This section documents the Encore iOS SDK's complete public API in a consistent format with clean parameter tables, comprehensive usage examples, and best practices.

<Note>
  **Looking for integration guides?**

  * **New to Encore?** Start with the [Getting Started Guide](/quickstart) for portal-guided setup
  * **Step-by-step integration:** See the [iOS Quickstart](/publishers/ios/quickstart/install) for detailed installation and configuration instructions
  * **Advanced setups:** This reference section is ideal for looking up specific methods, parameters, and advanced usage patterns
</Note>

## Core Methods

<CardGroup cols={2}>
  <Card title="configure()" icon="gear" href="/publishers/ios/sdk-reference/configure">
    Initialize the SDK with your public API key and optional UI configuration
  </Card>

  <Card title="identify()" icon="user" href="/publishers/ios/sdk-reference/identify">
    Associate your user ID with Encore for cross-device tracking
  </Card>

  <Card title="setUserAttributes()" icon="id-card" href="/publishers/ios/sdk-reference/set-user-attributes">
    Set structured attributes for targeting and analytics
  </Card>

  <Card title="reset()" icon="rotate-left" href="/publishers/ios/sdk-reference/reset">
    Clear user identification and cached entitlements on logout
  </Card>
</CardGroup>

## Presenting Offers

<CardGroup cols={2}>
  <Card title="placement()" icon="wand-magic-sparkles" href="/publishers/ios/sdk-reference/placement">
    Fluent API for presenting offers with optional callbacks or async/await
  </Card>

  <Card title="isActive()" icon="circle-check" href="/publishers/ios/sdk-reference/is-active">
    Check if an entitlement is currently active for the user
  </Card>

  <Card title="isActivePublisher()" icon="signal-stream" href="/publishers/ios/sdk-reference/is-active-publisher">
    Reactive Combine publisher for entitlement state changes
  </Card>
</CardGroup>

## Testing & Development

<CardGroup cols={2}>
  <Card title="revokeEntitlements()" icon="flask" href="/publishers/ios/sdk-reference/revoke-entitlements">
    Admin method to revoke all entitlements for testing offer flows end-to-end
  </Card>
</CardGroup>

## Types & Configuration

<CardGroup cols={2}>
  <Card title="UserAttributes" icon="user-tag" href="/publishers/ios/sdk-reference/user-attributes">
    Structured user attributes for targeting and personalization
  </Card>

  <Card title="Entitlements" icon="gift" href="/publishers/ios/sdk-reference/entitlements">
    Types of rewards granted when users accept offers
  </Card>

  <Card title="PresentationResult" icon="square-check" href="/publishers/ios/sdk-reference/presentation-result">
    Possible outcomes when presenting an offer
  </Card>

  <Card title="NotGrantedReason" icon="xmark-circle" href="/publishers/ios/sdk-reference/not-granted-reason">
    Reasons why an entitlement was not granted
  </Card>
</CardGroup>

## Error Handling

<CardGroup cols={2}>
  <Card title="Errors" icon="triangle-exclamation" href="/publishers/ios/sdk-reference/errors">
    Errors that can occur when using the SDK
  </Card>
</CardGroup>

## Basic Integration

### Passive Offer (fire-and-forget)

```swift theme={null}
// 1. Configure at launch
Encore.shared.configure(apiKey: "pk_live_your_key")

// 2. Identify user after login
Encore.shared.identify(userId: user.id)

// 3. Present offer — handlers (registered once at launch) drive the outcome
Encore.shared.placement("cancellation_flow").show()

// 4. Check entitlements (async with automatic smart refresh)
Task {
  if await Encore.shared.isActive(.freeTrial(), in: .verified) {
    unlockPremiumFeatures()
  }
}
```

### Async/Await Pattern (recommended)

Branch on the `PresentationResult` returned by `try await show()`:

```swift theme={null}
Button("Cancel Subscription") {
  Task {
    do {
      let result = try await Encore.shared.placement("cancellation_flow").show()
      switch result {
      case .granted(let entitlement):
        print("User accepted: \(entitlement)")
      case .notGranted:
        proceedWithCancellation()
      }
    } catch let error as EncoreError {
      // Transport / SDK error — never block the user.
      proceedWithCancellation()
    }
  }
}
```

<Note>
  The fluent `.onGranted { }` / `.onNotGranted { }` builder callbacks are **deprecated**. Prefer branching on the `PresentationResult` from `try await show()`, or register global [`onPurchaseRequest`](./on-purchase-request) / [`onPassthrough`](./on-passthrough) handlers.
</Note>

<Tip>
  For reactive state, subscribe with [`isActivePublisher`](./is-active-publisher) to keep premium UI in sync as provisional grants are verified or revoked.
</Tip>
