Swiftpack.co - stipop-development/stipop-ios-sdk as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by stipop-development.
stipop-development/stipop-ios-sdk v0.9.0-beta.1
150,000+ stickers API & SDK for iOS Apps.
⭐️ 21
🕓 1 year ago
.package(url: "https://github.com/stipop-development/stipop-ios-sdk.git", from: "v0.9.0-beta.1")

English | 한국어 Cover image

Stipop UI SDK for iOS

Release Beta SwiftPM compatible CocoaPods compatible

Stipop SDK provides over 150,000 .png and .gif?raw=true 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.

Requirements

  • Swift 5.4+
  • XCode 12.5+
  • iOS 12.0+

Getting started

Try demo(for XCode 13.0+)

  1. Download(or Clone) Demo App (SPM or Cocoapods Adjustment is not necessary)
git clone https://github.com/stipop-development/stipop-ios-sdk
  1. Add Stipop.plist file into the project

    screenshot

  2. Run demo app

Including in your project

Swift Package Manager

By XCode

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.

By Package.swift

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"))
]

Cocoapods

Copy & Paste below into Podfile. Then, run pod install.

pod 'StipopUIKit', '0.9.11'

How do I use Stipop SDK?

  1. Add Stipop.plist file into the project.
  2. 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)
            })
        }
    }
}
 */
  1. 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.
    }

}

Contact us

GitHub

link
Stars: 21
Last commit: 5 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

v0.9.11
5 weeks ago

v0.9.11 ( March 18, 2024 )

- Added a new parameter, priceTier, to the executePaymentForPackDownload function

: Each package has an individual price tier value. process your payment based on this tier.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics