I tried to use the updateData(fields: [AnyHashable : Any]) function to update an array in a document. It was working fine after a while I got a really strange error which I was unable to resolve, here's the error message:
global function '__designTimeString(_:fallback:)' requires that 'AnyHashable' conform to 'ExpressibleByStringLiteral'
----------------------------------------
CompileDylibError: Failed to build Data.swift
Compiling failed: global function '__designTimeString(_:fallback:)' requires that 'AnyHashable' conform to 'ExpressibleByStringLiteral'
Data.swift:115:17: error: global function '__designTimeString(_:fallback:)' requires that 'AnyHashable' conform to 'ExpressibleByStringLiteral'
__designTimeString("#64647.[4].[6].[3].modifier[2].arg[0].value.[0].key.[0].value", fallback: "reviews"): FieldValue.arrayUnion([id])
^
SwiftUI.__designTimeString:1:13: note: where 'T' = 'AnyHashable'
public func __designTimeString<T>(_ key: String, fallback: T) -> T where T : ExpressibleByStringLiteral
I have been looking around but couldn't really find much details on this kind of errors, please help :(
here's the part of my code that caused this error:
db.collection("restaurants").document(restaurantId).updateData([
"reviews": FieldValue.arrayUnion([id])
]) { err in
if let err = err {
print("Error updating document: \(err)")
} else {
print("Document successfully updated")
}
}