## Table of Contents
1. [Getting Started](#getting-started)
1. [Requirements](#requirements)
2. [Installation](#installation)
3. [Configuring Storyly](#configuring-storyly)
2. [Using StorylyMoments](#using-storylymoments)
1. [Initializing Storyly](#initializing-storyly)
2. [Loading Stories](#loading-stories)
3. [Handling Events](#handling-events)
4. [Customizing Storyly](#customizing-storyly)
3. [Advanced Topics](#advanced-topics)
1. [Segmentation and Targeting](#segmentation-and-targeting)
2. [User Analytics](#user-analytics)
3. [Integration with Existing Apps](#integration-with-existing-apps)
4. [Troubleshooting](#troubleshooting)
4. [API Reference](#api-reference)
5. [FAQ](#faq)
## Getting Started
### Requirements
To integrate StorylyMoments into your app, ensure the following requirements are met:
– [ ] iOS 11.0 or later
– [ ] Xcode 11 or later
– [ ] Storyly Developer Token (received upon registration)
### Installation
To install StorylyMoments, follow these steps:
1. Download the `StorylyMoments` SDK from [https://github.com/your-repo](https://github.com/your-repo).
2. Add the `StorylyMoments.xcodeproj` file to your project.
3. Open your project in Xcode.
4. Select your project’s target, go to the General tab, and scroll down to the “Frameworks, Libraries, and Embedded Content” section.
5. Click the “+” button, select `StorylyMoments.framework`, and add it to your project.
6. Make sure `Embed & Sign` is selected for the added framework.
7. Import the `Storyly` module where you want to use StorylyMoments.
### Configuring Storyly
To configure Storyly in your app, perform the following steps:
1. Within your app’s `AppDelegate.swift` file, import the Storyly module.
2. Add the following line of code to your `application(_:didFinishLaunchingWithOptions:)` method, replacing `your-developer-token` with your actual Storyly Developer Token:
“`swift
Storyly.sharedInstance()?.initWith(appGroup: nil, accessToken: “your-developer-token”)
“`
3. Ensure that you have specified the correct token, as errors might occur otherwise.
## Using StorylyMoments
### Initializing Storyly
To initialize Storyly in your app, follow these steps:
1. Add a UIView to your desired storyboard or XIB file.
2. Set the class of the added UIView to `StorylyView` in the Identity inspector.
3. Connect the UIView to your ViewController by creating an outlet.
4. In your ViewController code, import the Storyly module.
5. Add the following code to initialize Storyly using your StorylyView outlet:
“`swift
@IBOutlet weak var storylyView: StorylyView!
…
override func viewDidLoad() {
super.viewDidLoad()
storylyView.storylyLoaded = { storyGroupList in
// Success. You can show the loaded stories with this callback if needed.
}
storylyView.storylyLoadFailed = { errorMessage in
// Handle load failures with this callback.
}
storylyView.rootViewController = self
storylyView.refresh()
}
“`
### Loading Stories
To load stories dynamically, use the `refresh` method of the StorylyView class:
“`swift
storylyView.refresh()
“`
### Handling Events
Storyly provides callbacks for handling events such as story click, story long press, and others. To handle these events, use the following callbacks:
“`swift
storylyView.storylyEvent = { event in
if event.type == .storyClick {
// Handle story clicks
} else if event.type == .storyLongPress {
// Handle story long presses
}
// Handle other event types if needed
}
“`
### Customizing Storyly
You can customize Storyly’s appearance by configuring various properties. Here are some customizable options:
“`swift
storylyView.storyGroupSize = 3
storylyView.storyGroupIconSize = 70
storylyView.storyItemTextFontName = “Arial”
storylyView.backgroundColor = UIColor.white
“`
These are just a few examples; refer to the API Reference section for more customization options.
## Advanced Topics
### Segmentation and Targeting
By utilizing Storyly’s segmentation and targeting capabilities, you can show tailored stories to specific user segments. Learn more about segmentation and targeting in the [Segmentation and Targeting guide](https://your-website.com/segmentation-targeting).
### User Analytics
Storyly provides user analytics to track user behavior and engagement. Monitor user interactions, story views, and more by integrating Storyly’s analytics into your app. Refer to the [User Analytics guide](https://your-website.com/user-analytics) for further details.
### Integration with Existing Apps
If you have an existing app and wish to integrate Storyly, follow the guide on [Integration with Existing Apps](https://your-website.com/integration-existing-apps) to ensure a smooth integration process.
### Troubleshooting
If you encounter issues or have questions while using Storyly, refer to the [Troubleshooting guide](https://your-website.com/troubleshooting) for common solutions and suggestions.
## API Reference
For detailed information about Storyly’s API and available methods, refer to the [StorylyMoments API Reference](https://your-website.com/api-reference).
## FAQ
Find answers to frequently asked questions in the [StorylyMoments FAQ](https://your-website.com/faq) section.