Additional Methods

Static Attributes

  • currentUserId - current user id
  • currentApiKey - current api key set by initialize(apiKey: String, onComplete: () -> Void, onError: (Error) -> Void)
  • version - current SDK version
  • isInitialized - checks if Storyteller has been successfully initialized
  • isPresentingStory - checks if a Story is being presented at the moment
  • theme: the default fallback theming style used to render Story 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.

Parameters:

  • url - Deeplink URL. This usually is obtained from the AppDelegate method: application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool

openStory

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

This call opens a Story with a given identifier. It is individual Story requested per openStory call.

Parameters:

  • id - Story id
  • onError - 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 Story's Page with given identifier. It is individual Story requested per openPage call.

Parameters:

  • id - Page id
  • onError - called when there is any issue with opening a Story (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 - Deeplink URL. This is usually obtained from AppDelegate method: application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
  • onError - called when there is any issue with opening the deeplink (e.g. the requested content is no longer available)

dismissStoryView

dismissStoryView(animated: Bool, dismissReason: String, onComplete: (() -> Void))

The dismissStoryView() force closes the currently open Story View. If no Story View is open when this is called, it has no effect.

Parameters:

  • animated: 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
  • onComplete: called when Story has been dismissed or Story was not presented in the first place

Methods

initialize

initialize(apiKey: String, userInput: UserInput, categoriesToPreload: [String], onComplete: VoidCompletion, onError: ErrorCompletion)

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 - api key provided by the Storyteller team
  • userInput: id of the user to be authorized
  • categoriesToPreload: list of categories id to be preloaded. If array is empty the default category will be preloaded.
  • onComplete - called when initialization has finished and succeeded
  • onError - called when there is an issue with initialization
PREVIOUS
Forward Arrow