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

# iOS SDK

The BeyondWords iOS SDK allows you to embed the BeyondWords widget directly into your iOS applications.

The SDK uses a `WKWebView` to load the BeyondWords web widget and provides a native Swift interface for interacting with the underlying JavaScript API. As a result, most widget functionality and properties are shared across the iOS SDK and web widget.

You can compare supported properties in the [widget properties reference](https://docs.beyondwords.io/docs-and-guides/widget/developer-guides/properties.md).

Before you begin, make sure you have created a project and generated some content.

## Installation

### Install via CocoaPods

```ruby theme={null}
target 'MyApp' do
  pod 'BeyondWordsPlayer'
end
```

### Install via XCFramework

Download the XCFramework attached to the latest GitHub release.

> [card] [Download XCFramework](https://github.com/beyondwords-io/player-ios/releases/)
>
> View the latest iOS SDK releases on GitHub.

## Load content

### Add PlayerView to your view hierarchy

```swift theme={null}
let playerView = PlayerView()
playerViewParent.addSubview(playerView)
```

### Load content into the widget

```swift theme={null}
playerView.load(PlayerSettings(
    projectId: YOUR_PROJECT_ID,
    contentId: YOUR_CONTENT_ID
))
```

Replace `YOUR_PROJECT_ID` with your numeric project ID and `YOUR_CONTENT_ID` with your content ID.

Once your app is running, the widget will automatically load the specified content.

## Configuration

The preferred way to configure the widget is by going to the **Widget** page in your project dashboard.

However, you can override properties at the app level:

```swift theme={null}
playerView.load(PlayerSettings(
    projectId: YOUR_PROJECT_ID,
    contentId: YOUR_CONTENT_ID,
    playerStyle: "large",
    callToAction: "Listen to this recipe",
    backgroundColor: "yellow"
))
```

### Update properties after loading

You can also update properties after the widget has loaded:

```swift theme={null}
playerView.setPlayerStyle("large")
playerView.setBackgroundColor("yellow")
playerView.setPlaybackRate(1.5F)
```

## Lifecycle

Call `destroy()` on the `PlayerView` when you no longer need the widget, for example, when the view is removed from the hierarchy or the containing view controller is dismissed. This releases the underlying web view and widget resources.

```swift theme={null}
playerView.destroy()
```

## Example app

Refer to the example app, which demonstrates core widget functionality, including how to build a custom player UI.

> [card] [Example app](https://github.com/beyondwords-io/player-ios/tree/main/Example)
>
> Explore the example application on GitHub.

## GitHub repository

> [card] [iOS SDK repository](https://github.com/beyondwords-io/player-ios)
>
> View the source code, releases, and API documentation on GitHub.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.