Can not ForEach Int Array in Dictionary

I cannot ForEach the value of dictionary which is an Int array. Here is my code:

@State private var notedNumbers: [Int:[Int]] = [:]
ForEach(Array(notedNumbers.keys.enumerated()), id: \.element) { _, key in
                let row = key / 9
                let col = key % 9
                ForEach(notedNumbers[key].indices, id: \.self) { i in
                       // Cannot ForEach the Int Array here, compiler cannot type check the expression.
                }
            }

Many things may affect the error compiler cannot type check the expression. Can you show a complete code to reproduce the issue?

could you try this:

struct ContentView: View {
    @State private var notedNumbers: [Int:[Int]] = [0:[1,2]]

    var body: some View {
        ForEach(Array(notedNumbers.keys.enumerated()), id: \.element) { _, key in
            let row = key / 9
            let col = key % 9
            if let notedNumbersKey = notedNumbers[key] {
                ForEach(notedNumbersKey.indices, id: \.self) { i in
                    // Cannot ForEach the Int Array here, compiler cannot type check the expression.
                    Text("---> \(i)")
                }
            }
        }
    }
}

workingdogintokyo's answer works. I don't why the compiler cannot check dictionary by key. Thx for your help.

Can not ForEach Int Array in Dictionary
 
 
Q