My code ran stable before I upgraded to Xcode 13 yesterday. The warning from Apple is too general to figure out the reason.
The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
func createOrder() {
if Auth.auth().currentUser != nil {
let collection = db.collection("orders")
let document = collection.document()
let documentId = document.documentID
document.setData(["orderId": documentId,
"customerPhone": customerPhone ?? "",
"customerName": customerName ?? "",
"customerAddress": customerAddress ?? "",
"amountRed": amountRed ?? "0",
"amountYellow": amountYellow ?? "0",
"amountOrange": amountOrange ?? "0",
"amountSpecial": amountSpecial ?? "0",
"moneySum": moneySum ?? "0",
"shippingPrice": shippingPrice ?? "0",
"moneyDiscount": moneyDiscount ?? "0",
"moneyTotal": moneyTotal ?? "0",
"timestamp": timestamp ?? Date() ,
"note": note ?? "",
"status": status ?? "",
"shipperName": shipperName ?? "",
"shipperPhone": shipperPhone ?? ""
])
}
}
Thanks for your help.