Swiftpack.co - 1amageek/DocumentID as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by 1amageek.
1amageek/DocumentID 0.2.0
FirebaseFirestoreSwift's library for lightweight use of DocumentIDs in SwiftUI.
⭐️ 4
🕓 27 weeks ago
iOS macOS watchOS
.package(url: "https://github.com/1amageek/DocumentID.git", from: "0.2.0")


The Firebase iOS SDK provides a Swift extension as FirebaseFirestoreSwift, and I created this library for the following reasons.

  1. The official library is too heavy for SwiftUI.
  2. optional ID of DocumentID is difficult to use.

In the Identifiable use case, it is unlikely that the ID will be nil. Also, the DocumentID of Firestore itself can never be nil. This is because the DocumentID in Firestore is provided as a random AutoID by the client.

In this library, DocumentID is not optional, and AutoID can be used to issue the same AutoID as Firebase. Also, by using it together with FirestoreSwift, you can use FirestoreEncoder and FirestoreDecoder in the same way as FirebaseFirestoreSwift.


public struct YourItem: Identifiable {

    @DocumentID public var id: String

    public var text: String

    public init(id: String = AutoID.generate(), text: String) {
        self.id = id
        self.text = text


Stars: 4
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