I am trying to update the field "voteCount" inside of the eventContents array of eventContent.
here is the model:
struct EventContent: Identifiable, Codable, Hashable {
var id: String?
var url: String?
var data: Data?
var isVideo: Bool?
var voteCount: Int?
var userFullName: String?
private enum EventContent: String, CodingKey {
case id
case imageURL
case data
case isVideo
case voteCount
case userFullName
}
}
I know how to update the array of eventContents itself using updateData and FieldValue.arrayUnion - however, this updates the entire eventContent. How can I only update the "voteCount" field inside of my array of custom model?