This value becomes true after Storyteller is successfully initialized. Calling initialize again resets it to false until that call succeeds; it remains false if initialization throws.
A Boolean value indicating whether Storyteller content is currently presented.
This property is true when a Story Player, Clip Player, Search or Sheet is visible, and false otherwise. It updates automatically when content is presented or dismissed.
This instance property indicates whether the current Storyteller Player is muted. It is isolated to the main actor, so read it from UI code or another main-actor context.
This synchronously returns the cached Search setting. Before initialization succeeds, it may reflect default settings or settings cached for a previous tenant. The value is authoritative for the current tenant when isInitialized is true.
The eventTrackingOptions property customizes Storyteller's analytics and tracking behavior. This property is read-only and can only be set during SDK initialization. See Privacy and Tracking.
Call try await Storyteller.shared.mute() or try await Storyteller.shared.unmute() after initialization succeeds. These main-actor methods return after the native mute state has been accepted and applied to existing media. Calling either method before initialization completes throws StorytellerError.notInitialized.
To start silently, await mute() before opening a Story or Clip or enabling Embedded Clips playback. The explicit choice survives opening configuration and overrides an older saved preference for that opening, including when the mute button is hidden. No Player or audio session is started by the command.
During playback, mute and unmute leave video, playback position and pause state intact. A later user or device action can change audio normally. If mute-state persistence is enabled, the command also updates the saved preference used by later openings; the previous preference is not automatically restored. After the Player releases audio, the next activation follows the usual opening defaults and persistence settings. Repeating a command records the explicit choice without producing a duplicate mute transition. unmute() does not raise device volume or promise audible sound. These methods control Stories and full-screen or Embedded Clips; they do not control Cards.
The initialize method is required to be called for Storyteller to work. It's recommended to fire this method as soon as possible in the app lifecycle.
Parameters:
apiKey - This is the API key provided by the Storyteller team.
userInput - This is the ID of the user to be authorized. See Working with Users for more information on user IDs.
eventTrackingOptions - Configures analytics and tracking behavior. Defaults to .enableAll which enables all tracking options. Once set during initialization, these options can only be changed by reinitializing the SDK. See Privacy and Tracking for more information.
Throws - if there is an issue with initialization.
The dismissPlayer() force closes the currently open Story or Clips Player. If no Story or Clips Player is open when this is called, it has no effect.
Parameters:
animated - this decides whether to animate the dismissing of the view or not
dismissReason - an optional host-defined reason for closing the Story, Page, or Clip. When supplied, it populates StorytellerUserActivityData.dismissedReason on the corresponding dismissal event. Passing nil does not suppress the event; it leaves dismissedReason as nil. Delivery through onUserActivityOccurred is controlled by enableUserActivityTracking and, for Ad events, enableAdTracking.
This method waits for successful SDK initialization, then opens the Search screen when Search is enabled for the current tenant. If Search is disabled, or the calling task is cancelled while waiting, it returns without presenting anything or dismissing the current Player. It rechecks current tenant readiness after dismissing an existing Player and does not present Search if reinitialization has started. See Search for the complete invocation and cached isSearchEnabled semantics.
This method resumes the currently open Story or Player Views. If no Player is open when this is called, it has no effect.
If you use Storyteller.shared.useCustomShareHandling = true, call resumePlayer() after dismissing your custom share UI so the paused Storyteller content can continue playback.
On iOS, this method waits for successful SDK initialization before dismissing an active Player and loading the Sheet with the corresponding ID. If initialization restarts while the Player is being dismissed, it waits again before fetching the Sheet. Task cancellation and post-initialization Sheet errors propagate through the existing async throws call.
This method retrieves the total count of Clips in the specified Collection.
{"slug": "additional-methods", "page_title": "Use Additional SDK Methods", "page_url": "AdditionalMethods/", "canonical_url": "/ios/AdditionalMethods/", "markdown": "# Additional Methods\n\nThis page is a reference for `Storyteller.shared` properties and methods that are useful during integration.\n\nFor dedicated topics, see:\n\n- [Opening content](OpenPlayer.md)\n- [Deep linking](Deeplinking.md)\n- [Search](Search.md)\n- [Ads](Ads.md)\n- [Analytics](Analytics.md)\n\n## Table of Contents\n\n- [Properties](#properties)\n- [Methods](#methods)\n\n## Properties\n\n### `delegate`\n\nThe delegate is responsible for things like fetching ads and handling in-app navigation. More detailed info can be found in [Storyteller Delegates](StorytellerDelegate.md).\n\n### `modules`\n\nThis is a list of [StorytellerModule](StorytellerModule.md) instances that can extend Storyteller (for example: host-supplied ads), alongside the delegate.\n\nSee the Showcase setup that registers modules and the delegate in [`AppDelegate.setupStoryteller`](https://github.com/getstoryteller/storyteller-showcase-ios/blob/11.8.0/main/ShowcaseApp/ShowcaseApp.swift#L95).\n\n### `currentApiKey`\n\nThis is the current API key set when using `Storyteller.shared.initialize(...)`.\n\n### `version`\n\nThis is the current SDK version (for example `\"11.4.0\"`).\n\n<!-- storyteller-swift-example: id=additionalmethods-01 target=sdk-ios context=statements -->\n\n```swift\nlet version = Storyteller.shared.version\n```\n\n### `isInitialized`\n\nThis value becomes `true` after Storyteller is successfully initialized. Calling `initialize` again resets it to `false` until that call succeeds; it remains `false` if initialization throws.\n\n<!-- storyteller-swift-example: id=additionalmethods-02 target=sdk-ios context=statements -->\n\n```swift\nlet isInitialized = Storyteller.shared.isInitialized\n```\n\n### `isPresentingContent`\n\nA Boolean value indicating whether Storyteller content is currently presented.\n\nThis property is `true` when a Story Player, Clip Player, Search or Sheet is visible, and `false` otherwise. It updates automatically when content is presented or dismissed.\n\n### `isPlayerMuted`\n\nThis instance property indicates whether the current Storyteller Player is muted. It is isolated to the main actor, so read it from UI code or another main-actor context.\n\n<!-- storyteller-swift-example: id=additionalmethods-player-muted target=sdk-ios context=declarations -->\n\n```swift\n@MainActor\nfunc updateMuteIndicator() {\n let isMuted = Storyteller.shared.isPlayerMuted\n print(\"Player muted: \\(isMuted)\")\n}\n```\n\n### `isSearchEnabled`\n\nAvailable only on iOS.\n\nThis synchronously returns the cached Search setting. Before initialization succeeds, it may reflect default settings or settings cached for a previous tenant. The value is authoritative for the current tenant when `isInitialized` is `true`.\n\n### `theme`\n\nThis is the default fallback theming style used to render Story or Clips items in lists and activities launched from lists.\n\n### `user`\n\nAllows setting or removing custom attributes for personalization and audience targeting. See [Working with Users](Users.md).\n\n<!-- storyteller-swift-example: id=additionalmethods-03 target=sdk-ios context=statements -->\n\n```swift\nStoryteller.shared.user.setCustomAttribute(key: \"location\", value: \"New York\")\n```\n\n### `eventTrackingOptions`\n\nThe `eventTrackingOptions` property customizes Storyteller's analytics and tracking behavior. This property is read-only and can only be set during SDK initialization. See [Privacy and Tracking](PrivacyAndTracking.md).\n\n## Methods\n\nMost of the methods below are async and should be called from a `Task` or another async context.\n\n### mute and unmute\n\nCall `try await Storyteller.shared.mute()` or `try await Storyteller.shared.unmute()` after initialization succeeds. These main-actor methods return after the native mute state has been accepted and applied to existing media. Calling either method before initialization completes throws `StorytellerError.notInitialized`.\n\nTo start silently, await `mute()` before opening a Story or Clip or enabling Embedded Clips playback. The explicit choice survives opening configuration and overrides an older saved preference for that opening, including when the mute button is hidden. No Player or audio session is started by the command.\n\n<!-- storyteller-swift-example: id=additionalmethods-host-mute target=sdk-ios context=declarations -->\n\n```swift\n@MainActor\nfunc openMutedClips(collectionId: String) async throws {\n try await Storyteller.shared.mute()\n let configuration = StorytellerClipCollectionConfiguration(collectionId: collectionId)\n try await Storyteller.shared.openCollection(configuration: configuration)\n}\n```\n\nDuring playback, mute and unmute leave video, playback position and pause state intact. A later user or device action can change audio normally. If mute-state persistence is enabled, the command also updates the saved preference used by later openings; the previous preference is not automatically restored. After the Player releases audio, the next activation follows the usual opening defaults and persistence settings. Repeating a command records the explicit choice without producing a duplicate mute transition. `unmute()` does not raise device volume or promise audible sound. These methods control Stories and full-screen or Embedded Clips; they do not control Cards.\n\n### initialize\n\n<!-- storyteller-swift-example: id=additionalmethods-04 target=sdk-ios context=statements -->\n\n```swift\ntry await Storyteller.shared.initialize(apiKey: \"YOUR_API_KEY\")\n```\n\nThe `initialize` method is required to be called for Storyteller to work. It's recommended to fire this method as soon as possible in the app lifecycle.\n\nParameters:\n\n- **apiKey** - This is the API key provided by the Storyteller team.\n- **userInput** - This is the ID of the user to be authorized. See [Working with Users](Users.md) for more information on user IDs.\n- **eventTrackingOptions** - Configures analytics and tracking behavior. Defaults to `.enableAll` which enables all tracking options. Once set during initialization, these options can only be changed by reinitializing the SDK. See [Privacy and Tracking](PrivacyAndTracking.md) for more information.\n\n**Throws** - if there is an issue with initialization.\n\n### dismissPlayer\n\n<!-- storyteller-swift-example: id=additionalmethods-05 target=sdk-ios context=statements -->\n\n```swift\nawait Storyteller.shared.dismissPlayer(animated: true, dismissReason: \"host-navigation\")\n```\n\nThe `dismissPlayer()` force closes the currently open Story or Clips Player. If no Story or Clips Player is open when this is called, it has no effect.\n\nParameters:\n\n- `animated` - this decides whether to animate the dismissing of the view or not\n- `dismissReason` - an optional host-defined reason for closing the Story, Page, or Clip. When supplied, it populates `StorytellerUserActivityData.dismissedReason` on the corresponding dismissal event. Passing `nil` does not suppress the event; it leaves `dismissedReason` as `nil`. Delivery through `onUserActivityOccurred` is controlled by `enableUserActivityTracking` and, for Ad events, `enableAdTracking`.\n\n### openSearch\n\nAvailable only on iOS.\n\n<!-- storyteller-swift-example: id=additionalmethods-06 target=sdk-ios context=statements -->\n\n```swift\nawait Storyteller.shared.openSearch()\n```\n\nThis method waits for successful SDK initialization, then opens the Search screen when Search is enabled for the current tenant. If Search is disabled, or the calling task is cancelled while waiting, it returns without presenting anything or dismissing the current Player. It rechecks current tenant readiness after dismissing an existing Player and does not present Search if reinitialization has started. See [Search](Search.md#how-to-use) for the complete invocation and cached `isSearchEnabled` semantics.\n\n### resumePlayer\n\n<!-- storyteller-swift-example: id=additionalmethods-07 target=sdk-ios context=statements -->\n\n```swift\nStoryteller.shared.resumePlayer()\n```\n\nThis method resumes the currently open Story or Player Views. If no Player is open when this is called, it has no effect.\n\nIf you use `Storyteller.shared.useCustomShareHandling = true`, call `resumePlayer()` after dismissing your custom share UI so the paused Storyteller content can continue playback.\n\n### openSheet\n\nAvailable only on iOS.\n\n<!-- storyteller-swift-example: id=additionalmethods-08 target=sdk-ios context=statements -->\n\n```swift\ntry await Storyteller.shared.openSheet(id: \"sheet-id\")\n```\n\nOn iOS, this method waits for successful SDK initialization before dismissing an active Player and loading the Sheet with the corresponding ID. If initialization restarts while the Player is being dismissed, it waits again before fetching the Sheet. Task cancellation and post-initialization Sheet errors propagate through the existing `async throws` call.\n\n### getStoriesCount\n\n<!-- storyteller-swift-example: id=additionalmethods-09 target=sdk-ios context=statements -->\n\n```swift\nlet storiesCount = await Storyteller.shared.getStoriesCount(for: [\"category-id\"])\n```\n\nThis method retrieves the total count of Stories for the specified category IDs.\n\n### getClipsCount\n\n<!-- storyteller-swift-example: id=additionalmethods-10 target=sdk-ios context=statements -->\n\n```swift\nlet clipsCount = await Storyteller.shared.getClipsCount(for: \"collection-id\")\n```\n\nThis method retrieves the total count of Clips in the specified Collection.\n", "copy_markdown_include_header": false, "base_path": "", "ai_dir": "ai", "missing_payload_behavior": "empty"}