SwiftSocialKit is a Swift Package that enables simple sharing of media content (photos, videos) to Instagram and TikTok, as well as direct saving to the device. It's so simple that it's literally just one function such as postPhotoAsStory()
or postVideoAsTikTok()
. SwiftSocialKit is currnetly used in the app One Hundred Questions.
- Share images and videos to Instagram Stories
- Share videos to TikTok and Instagram Reels
- Save media directly to the device
- Built natively in Swift
Use Swift Package Manager to add the package to your project:
https://github.com/nicolaischneider/SwiftSocialKit.git
Add the following line to your Podfile
:
pod 'SwiftSocialKit'
Then run pod install
and open your .xcworkspace
.
If you only need specific components, you can install them individually:
# For saving content to device only
pod 'SaveToDeviceKit'
# For Instagram sharing functionality
pod 'InstagramShareKit'
# For TikTok sharing functionality
pod 'TikTokShareKit'
- SaveToDeviceKit: Find the Setup here
- InstagramShareKit: Find the Setup here
- TikTokShareKit: Find the Setup here
All you need is access to your image/video and pass it on to the respective instance which will take care of the rest.
import InstagramShareKit
import SaveToDeviceKit
import TikTokShareKit
// Instagram
let instagramKit = InstagramShareKit(facebookID: "your-facebook-app-id")
let instagramState1 = instagramKit.postPhotoAsStory(yourUIImage)
let instagramState2 = instagramKit.postVideoAsStory(yourVideoURL)
let instagramState3 = instagramKit.postVideoAsReel(yourVideoURL)
// Save to device
let saveKit = SaveToDeviceKit()
let saveImageState = await saveKit.saveImage(photo: yourUIImage)
let saveVideoState = await saveKit.saveVideo(video: yourVideoURL)
// TikTok
let tiktokKit = TikTokShareKit()
let tiktokState = await tiktokKit.postVideoAsTikTok(video: yourVideoURL, redriectURI: "your-redirect-uri")
- Support for Snapchat
- Ability to add stickers to Instagram stories and reels
This app uses the following third party swift packages:
- TikTokOpenSDK for iOS: the licence can be found here