FirebaseFirestoreSwift Packaging Firebase with SwiftUI

How can I solve the following problem? :

Cannot convert value of type 'Party' to expected argument type '[String : Any]'

My Struct Party :

import Foundation import FirebaseFirestoreSwift import FirebaseFirestore import Combine 

struct Party:Identifiable,Decodable {

    @DocumentID var id: String?     var UserHome:String     var HomeType:String     var Description:String     var Alcool:Bool     var Food:Bool     var day:String     var heure:String     var Price:Double     var image:[String]?     var locale:String     var placeRest:Int     @ServerTimestamp var createdTime:Timestamp? }


I' use Firebase packaging

import Foundation

import FirebaseFirestore // (1)

import FirebaseFirestoreSwift

  func addParty(party:Party){

        do{

            let _ = try db.collection("party").addDocument(data: party) //Cannot convert value of type 'Party' to expected argument type '[String:Any]'

        }

        catch{

            print("Il y a eu une erreur au moment de la sauvegarde de la Soirée")

        }

    }


I do not want to go deep into Firestore, as it is not a framework of Apple's. But you may need to use addDocument(from:) instead of addDocument(data:). Better visit a supporting site or a community site of Firestore.

FirebaseFirestoreSwift Packaging Firebase with SwiftUI
 
 
Q