IGStoryKit lets you easily share content stickers with different background types to Instagram stories from your iOS and iPadOS apps.
IGStoryKit is available via Swift Package Manager. To add
IGStoryKit simply add this repo’s URL to your project’s package file.
You can find a detailed tutorial here. However, a simple setup is mentioned below.
Please ensure that you’ve created a
LSApplicationQueriesSchemesentry in your project’s Info.plist file and added an
instagram-storiesentry. Without this your project will not be able to copy data into Instagram stories and this framework will thrown an assertion failure during debug runtime.
let igData = IGData(backgroundType: .gradient, colorTop: .systemOrange, colorBottom: .systemRed, backgroundImage: nil, contentSticker: nil)
Next, create an instance of
IGDispatcher and initialize it with the
igData created above.
Create an instance of
let igDispatcher = IGDispatcher(igData: igData)
Start the posting flow by called start() on the dispatcher
Instagram suggests particular sizes for images shared to Instagram stories on their developer site.
|Asset||Preferred Size||For BackgroundType|
|Background Image||720x1080 (9:16 or 9:18)||
Understanding how IGKit works
IGData is a Swift object that defines the data being shared to Instagram stories. It contains the following parameters:
backgroundType: Defines the
BackgroundTypeof the story.
BackgroundTypeis discussed in detail below.
colorTop: Defines the top color of the story background. In case of
.colorbackground type, the
colorTopcolor is used as a solid color background.
colorBottom: Defines the bottom color of the story background. Used only in the case of
.gradientbackground type. In conjunction with the
colorTopproperty, Instagram renders a linear gradient as the story background.
backgroundImage: Defines the background image of the story background. Used only in the case of
contentSticker: Defines a content sticker image property. This sticker can be customized by the user in the Instagram app.
BackgroundType is an enum that describes the background type of the Instagram Story. It can be of 4 pre defined types:
none: No background. This mode requires that the user shares a sticker image content.
color: A solid color background. User provides a
UIColorvalue and the
IGDispatcherclass creates a Instagram story with a solid background color. For this case the user may or may not provide a sticker content image. In case the user doesn’t provide a sticker content image
IGDispatcherwill only create a story with a solid color background.
gradient: A linear gradient background. User provides two
colorBottomwhile configuring an
IGDispatcherclass then creates an Instagram story with a linear gradient background. For this case, the user may or may not provide a sticker content image. In case the user doesn’t provide a sticker content image
IGDispatcherwill only create a story with a linear gradient background.
image: An image background. User provides an
backgroundImageparameter while creating an object of type
IGDispatcherclass then creates an Instagram story with an image background. For this case, the user may or may not provide a sticker content image. In case the user doesn’t provide a sticker content image
IGDispatcherwill only create a story with an image background.
Like the framework?
If you like
IGStoryKit please consider buying me a coffee 🥰
Contributions are always welcome. Please follow the following convention if you’re contributing:
- NameOfFile: Changes Made
- One commit per feature
- For issue fixes: #IssueNumber NameOfFile: ChangesMade
This project is licensed under the MIT License - see the LICENSE file for details
Apps using IGStoryKit
If you’re using IGStoryKit in your app please open a PR to edit this Readme. I’ll be happy to include you in this list :D