Stipop SDK provides over 150,000 .png and .gif stickers that can be easily integrated into mobile app chats, comment sections, live streams, video calls, etc. Bring fun to your mobile app with stickers loved by millions of users worldwide.
- Swift 5.4+
- XCode 12.5+
- iOS 12.0+
-
Check Stipop Docs for the comprehensive guide.
-
Sign up to Stipop Dashboard to download Stipop.plist file.
- Download(or Clone) Demo App (SPM or Cocoapods Adjustment is not necessary)
git clone https://github.com/stipop-development/stipop-ios-sdk
Go to File > Swift Packages > Add Package Dependency... Enter https://github.com/stipop-development/stipop-ios-sdk
.
Then select a version you want to use.
If you have a Swift Package, add dependency into Package.swift
dependencies: [
.package(url: "https://github.com/stipop-development/stipop-ios-sdk.git", .upToNextMajor(from: "0.9.11"))
]
Copy & Paste below into Podfile
. Then, run pod install
.
pod 'StipopUIKit', '0.9.11'
- Add Stipop.plist file into the project.
- Import Stipop and Initialize Stipop SDK before use at AppDelegate.
import UIKit
import Stipop
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
// let semaphore = DispatchSemaphore(value: 1)
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// If you want to use SAuth, execute setSAuthDelegate method.
// *setSAuthDelegate() should be typed before initialize()
// Stipop.setSAuthDelegate(sAuthDelegate: self)
Stipop.initialize()
return true
}
...
}
/* If you use SAuth, implement SAuthDelegate and refresh accessToken when authorization error occured. */
/*
extension AppDelegate: SAuthDelegate {
func httpError(apiEnum: SPAPIEnum, error: SPError) {
print("⚡️Stipop: HTTP Error => \(apiEnum)")
DispatchQueue.global().async {
self.semaphore.wait()
DemoSAuthManager.getAccessTokenIfOverExpiryTime(userId: Stipop.getUser().userID, completion: { accessToken in
self.semaphore.signal()
guard let accessToken = accessToken else { return }
Stipop.setAccessToken(accessToken: accessToken)
SAuthManager.reRequest(api: apiEnum)
})
}
}
}
*/
- Go to the View Controller where you want to place the button. Then, Initialize SPUIButton and connect delegate.
import UIKit
import Stipop
class ViewController: UIViewController {
let stipopButton = SPUIButton(type: .system)
override func viewDidLoad() {
super.viewDidLoad()
self.view.addSubview(stipopButton)
stipopButton.translatesAutoresizingMaskIntoConstraints = false
stipopButton.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
stipopButton.centerYAnchor.constraint(equalTo: view.topAnchor, constant: 150).isActive = true
stipopButton.heightAnchor.constraint(equalToConstant: 25).isActive = true
stipopButton.widthAnchor.constraint(equalToConstant: 25).isActive = true
let user = SPUser(userID: "some_user_id")
stipopButton.setUser(user, viewType: .picker)
stipopButton.delegate = self
}
}
extension ViewController: SPUIDelegate {
func onStickerSingleTapped(_ view: SPUIView, sticker: SPSticker) {
// This function will be executed when user chooses a sticker.
}
/* If you want to use double tap feature, change the plist file and implement this function. */
func onStickerDoubleTapped(_ view: SPUIView, sticker: SPSticker) {
// This function will be executed when user chooses a sticker.
}
}
- For more information, visit Stipop Docs.
- Email us at tech-support@stipop.io if you need any help.