Skip to content

SwiftSocialKit makes sharing photos and videos to Instagram, TikTok, or saving them to the device effortless with simple, native Swift functions.

License

Notifications You must be signed in to change notification settings

nicolaischneider/SwiftSocialKit

Repository files navigation

SwiftSocialKit

Swift iOS v13+ License

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(). SwiftSocialKit is currnetly used in the app One Hundred Questions.

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.git

CocoaPods

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

  • SaveToDeviceKit: Find the Setup here
  • InstagramShareKit: Find the Setup here
  • TikTokShareKit: Find the Setup here

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:

About

SwiftSocialKit makes sharing photos and videos to Instagram, TikTok, or saving them to the device effortless with simple, native Swift functions.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published