nicolaischneider/swiftsocialkit
**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()`. SwiftSo
Features
- Share images and videos to Instagram Stories
- Share videos to TikTok and Instagram Reels
- Save media directly to the device
- Built natively in Swift
Installation
Swift Package Manager
Use Swift Package Manager to add the package to your project:
https://github.com/nicolaischneider/SwiftSocialKit.gitCocoaPods
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'Setup
Usage
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")Planned Features
- Support for Snapchat
- Ability to add stickers to Instagram Stories and Reels
Third-Party Licenses
This app uses the following third party swift packages:
- TikTokOpenSDK for iOS: the licence can be found here
Package Metadata
Repository: nicolaischneider/swiftsocialkit
Default branch: main
README: README.md