ฉันกำลังพยายามรับจำนวนเงินจาก firstArray จากนั้นจึงผนวกเข้ากับ SecondArray ฉันได้รับข้อผิดพลาดนี้: "ไม่สามารถเรียกใช้ตัวเริ่มต้นสำหรับประเภท 'ForEach‹_, _, _>' พร้อมด้วยรายการอาร์กิวเมนต์ประเภท '([Number], @escaping (Double) -> ())'"
struct Number: Identifiable {
let id = UUID()
let amount: Double
}
struct ContentView: View {
@State var firstArray = [Number(amount: 10),Number(amount: 30),Number(amount: 50)]
@State var secondArray = [Double]()
var body: some View {
VStack {
ForEach(firstArray) { row in
secondArray.append(row.amount)
}
}
}
}
Number
- person AlexH   schedule 23.11.2019