Swiftpack.co - joreilly/ConfettiSwiftPackage as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by joreilly.
joreilly/ConfettiSwiftPackage 0.6.0
Swift Package for https://github.com/joreilly/Confetti
⭐️ 2
🕓 2 weeks ago
iOS
.package(url: "https://github.com/joreilly/ConfettiSwiftPackage.git", from: "0.6.0")

ConfettiSwiftPackage

Swift Package for https://github.com/joreilly/Confetti. Note that this uses https://github.com/rickclephas/KMP-NativeCoroutines library and right now Swift Package for this needs to be also manually added (looking at ways to do this automatically).

Example SwiftUI code

import SwiftUI
import ConfettiKit
import KMPNativeCoroutinesAsync


struct ContentView: View {
    let repository = ConfettiRepository()
    @State var sessions: [SessionDetails] = []
    
    var body: some View {
        List(sessions, id: \.id) { session in
            Text(session.title)
        }
        .task {
            await observeSessions()
        }
    }
    
    func observeSessions() async {
        do {
            let stream = asyncStream(for: repository.sessionsNative)
            for try await data in stream {
                self.sessions = data
            }
        } catch {
            print("Failed with error: \(error)")
        }
    }
}

Note that it's also necessary to initialise Koin (like following for example)

import SwiftUI
import ConfettiKit

@main
struct YourApp: App {
    init() {
        KoinKt.doInitKoin()
    }
    
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

GitHub

link
Stars: 2
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

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