Quick Start

Quick Start

This walkthrough shows how to add Storyly Moments to your iOS application and forward your users to create their own stories.


Before you begin

This walkthrough requires a user payload which is explained in user payload section and a Storyly Moments token which is retrieved from Storyly Dashboard.




Storyly Moments SDK targets iOS 11 or higher.


Storyly Moments SDK is available through CocoaPods. To integrate Storyly Moments SDK into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'StorylyMoments'

Then run pod install.



Please note that CocoaPods version should be 1.9+


Storyly Moments SDK is available through Carthage. To integrate Storyly Moments SDK into your Xcode project using Carthage, specify it in your Cartfile:

binary "https://prod-storyly-media.s3.eu-west-1.amazonaws.com/storyly-moments-sdk/Carthage/StorylyMoments.json"

Then run carthage update --use-xcframeworks.

After, add the frameworks to your Xcode project: Go to targets and select your application. Click plus button from the Frameworks, Libraries, and Embedded Content section and add StorylyMoments.xcframework. If you can't find, add from Add Other > Add files dialog. Frameworks will be located at Carthage/Build/.



Please note that Carthage version should be 0.38+

Import Storyly Moments

You need to import related modules to use Storyly Moments:

import StorylyMoments

Initialize Storyly Moments

Basic usage of Storyly Moments requires initialization of StorylyMomentsManager with a Config parameter. storylyMomentsDelegate is not required to initialize StorylyMomentsManager, but if you want to be informed about Storyly Moments events then you need to provide your delegate with this parameter. You can find more information about this StorylyMomentsDelegate in Set up Delegate section.

self.storylyMoments = StorylyMomentsManager(config: Config, storylyMomentsDelegate: StorylyMomentsDelegate? = nil)

Configuration of StorylyMomentsManager is done by Config parameter. Initialization of Config requires two string parameters, one of them is user payload and the other one is Storyly Moments token. You can get your Storyly Moments token from the Storyly Dashboard -> Settings -> Moments. For more information about the user payload please check User Payload section.

self.storylyMomentsConfig = Config(momentsToken: String, userPayload: String)



Do not forget to set rootViewController variable of Storyly Moments instance as your view controller.

self.storylyMoments.rootViewController = self

You need to set StorylyMomentsManager to call main functions of Storyly Moments.

var storylyMoments = StorylyMomentsManager(config: Config(momentsToken: MOMENTS_TOKEN, userPayload: USER_PAYLOAD), momentsDelegate: self)

Main Functions

Storyly Moments presents two basic functions for your users. These are Create and Share Story and Open My Stories which will be explained below:

Create and Share Story

After Storyly Moments is initialized, you are ready to direct your users to create their first story by calling the following function using your Storyly Moments instance:

public func createStory(mediaImport: MediaImport? = nil)

After you call createStory function without mediaImport parameter, if your users give necessary permission, they will be directed to their media library. For more information about permissions and their effects on story creation please check Permissions section. In media library, your users can take the following actions:

  • Select a single media to share
  • Select multiple media to share
  • Open camera to capture media (If permission is given)

Selecting one of these options will open a share story screen for last review of the media. In share story screen, users can review the selected media and they can either discard or share media. After upload and share process is successful, users will be directed to my stories screen to see their newly created stories.

If you call createStory function with mediaImport parameter, your users will be directed to story sharing screen straight away with the provided media. For more information about MediaImport class please check API reference.

Open User Stories

Using this function, you can let your users view their live stories by opening my stories screen. In my stories screen, your users are able to check who has seen or liked their stories. They can also delete their live stories. You can direct your users to this screen using the following function:

public func onUserStoriesOpen()

Initiate Main Functions From Storyly Bar

For your application users to see the stories of their followers, you should integrate Storyly SDK into your application. For this, you should initialize your Storyly instance by passing the user payload to the storylyPayload parameter as follows:

public convenience init(storylyId: String, storylyPayload: String) {
    self.init(storylyId: storylyId)
    self.storylyPayload = storylyPayload

If you have already connected your Storyly Moments instance to your Storyly instance of your application from dashboard and initialize the Storyly instance by sending the user payload through storylyPayload parameter, users will be able to see stories of their followers by default.

In addition to these follower story groups, Storyly SDK allows you to add custom Storyly Moments views in order to initiate story create process or show user's own stories from Storyly bar. You can create your own views and assign those views to the following momentsItems variable of StorylyView:

public var momentsItems: [MomentsItem]?



Assigned custom views will be the initial story groups and their places will be fixed.

Set up Delegate

This walkthrough shows you how to handle Storyly Moments events in your app. Storyly Moments events provide insight on what your user intend to do in Storyly Moments such as opening gallery to create story or opening the user stories to preview.

Storyly Moments notifies application when an event occurs. You can adopt StorylyMomentsDelegate protocol in your code, and then override its functions to learn about specific events, which will be explained in the next sections.



Do not forget to provide the class that adopts StorylyMomentsDelegate in Storyly Moments setup.

onStoryCreatorOpen Event

This event will let you know that your users intend to create a story. isDirectMediaUpload parameter denotes whether the users intend to create a story using application provided media or library/camera media. In order to be notified about this event, override the following function in your delegate:

func onStoryCreatorOpen(isDirectMediaUpload: Bool)

onUserStoriesOpen Event

This event will let you know that your users intend to view their stories. In order to be notified about this event, override the following function in your delegate:

func onUserStoriesOpen()

onUserStoriesLoaded Event

This event will let you know that your loading of user stories is successful. momentsStoryGroup parameter denotes loaded user story group information. In order to be notified about this event, override the following function in your listener:

func onUserStoriesLoaded(momentsStoryGroup: MomentsStoryGroup?)

onUserStoriesLoadFailed Event

This event will let you know that your loading of user stories loading is failed. errorMessage parameter denotes fail reason of the loading. In order to be notified about this event, override the following function in your listener:

func onUserStoriesLoadFailed(errorMessage: String)

onPreModeration Event

This event will let you to pre-moderate the content before going live. With this callback, you can prevent harmful text or URL content to go live.

 func onPreModeration(preModerationList: [PreModeration]?)



onPreModeration should be handled real-time. Async pre-moderation is not possible. If you use it as async, the Story might already be uploaded.

Below, you can find an example usage: