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.
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.
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 opens the Search screen when isSearchEnabled is true. If Search is disabled for the tenant, the method returns without presenting anything. See Search for a prerequisite check and complete invocation.
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.
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.6.1/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\nThis value is `true` when the Search feature is enabled in the tenant configuration.\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### 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\n<!-- storyteller-swift-example: id=additionalmethods-06 target=sdk-ios context=statements -->\n\n```swift\nawait Storyteller.shared.openSearch()\n```\n\nThis method opens the Search screen when `isSearchEnabled` is `true`. If Search is disabled for the tenant, the method returns without presenting anything. See [Search](Search.md#how-to-use) for a prerequisite check and complete invocation.\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\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\nThis method loads and opens a Sheet with the corresponding ID.\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"}