Additional Methods

Table of Contents

  1. Static Attributes
  2. Static Methods
  3. Initialize Method

Static Attributes

currentApiKey

This is the current API key set when using initialize.

currentUserId

This is the current user ID.

version

This is a static strong property that holds the current SDK version.

isInitialized

This is a boolean static property which is set to true if Storyteller was successfully initialized.

isPlayerVisible

This is a boolean property that is set to true when a Story or Clip player is opened and false when the Story or Clip player is dismissed.

theme

This is the default fallback theming style used to render Story or Clips items in lists and activities launched from lists.

Static Methods

isStorytellerDeeplink

isStorytellerDeeplink(url: URL) -> Bool

This checks if the given URL is a Storyteller deeplink. For more information on deeplinking, see the dedicated Deeplinking page.

openStory

openStory(id: String, onError: @escaping ((Error) -> Void))

This call opens a Story with a given ID. The call will only open that individual Story.

Parameters:

  • id - this is a Story's ID

  • onError - this is called when there is an issue with opening a Story (e.g. the requested content is no longer available)

openPage

openPage(id: String, onError: @escaping ((Error) -> Void))

This call opens a Page with a given ID. The call will only open that individual Page.

Parameters:

  • id - this is a Page's ID.

  • onError - this is called when there is an issue with opening a Page (e.g. the requested content is no longer available).

openDeeplink

openDeeplink(url: URL, onError: ((Error) -> Void)) -> Bool

This call makes Storyteller open the provided deeplink (showing the requested Page/Story). The method returns true if the URL is a Storyteller deeplink.

Parameters:

  • url - this is the Deeplink URL.

  • onError - this is called when there is any issue with opening the deeplink (e.g. the requested content is no longer available).

For more information on deeplinking, see the dedicated Deeplinking page.

dismissPlayer

dismissPlayer(animated: Bool, dismissReason: String)

The dismissPlayer() force closes the currently open Story or Clips View. If no Story or Clips View 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 - the reason why the Story Page was force closed. This will be used to populate the dismissedReason parameter of the corresponding onUserActivityOccurred callback. If this is set to null the onUserActivityOccurred callback will not be triggered

Methods

initialize

initialize(apiKey: String, userInput: UserInput? = nil, onComplete: @escaping VoidCompletion = {}, onError: @escaping ErrorCompletion = { _ in })

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.

categoriesToPreload

This is the list of categories ID to be preloaded. If array is empty the default category will be preloaded.

onComplete

This is called when initialization has finished and succeeded.

onError

This is called when there is an issue with initialization.

PREVIOUS
Forward Arrow