I understand the problem, but I don't know how to solve it, I found other thread, but they are very specific problem. I have my for var:
static var DeliveryStatusArray =
[
"claimable": [],
"onTime": [],
"future": [],
"claimDone": [],
"tooOld": [],
]
My function is :
static func moreCard(status:String, newJson: JSON)
{
var json = JSON(DeliveryStatusArray[status] as Any)
var tmpArray = json[0]["cards"].arrayValue
newJson["cards"].array?.insert(tmpArray, at: 0)
DashboardManager.DeliveryStatusArray[status]?.removeAll()
DashboardManager.DeliveryStatusArray[status] = tmpArray
}
In this function I want to insert at the begining of newJson["cards"] tmpArray. In second time I need to pass newJson at DeliveryStatusArray["status"]. I got my error on the line
newJson["cards"].array?.insert(tmpArray, at: 0)
In my view, the prototype of my function is:DashboardManager.moreCard(status: section, newJson: json["data"])