有货币汇率的数组,并且在inputTextField中输入了金额之后,我想更新此货币上的该数组中的所有项目,并将该货币放在tableView中,尝试使用循环来执行此操作,但这不能正常工作,因为这是解决方案刚刚放在表中的每个循环
inputTextField是文本字段的名称
receivedRates:[Double] = [1.1,1.6,2.0,1.3] // just example of the rates
for i in receivedRates {
let newValue = Double(i)*Double(Int(inputTextField.text!)!)
currentAmount.append(newValue)
receivedRates = currentAmount
}
Run Code Online (Sandbox Code Playgroud)
如何不循环地更新此数组,或者可能对此循环有其他解决方案?