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")
}
}
Selecting any option will automatically load the page