Find index of dictionary entry in Swift
<p>I am trying to find the index of an entry in a dictionary. My dictionary is as follows:</p>

<pre><code>//  Dictionary
var questions: [[String:Any]] = [
    [
        "quesID": 1000,
        "question": "What is the capital of Alabama?",
        "answer": "Montgomery",
    ],
    [
        "quesID": 1001,
        "question": "What is the capital of Alaska?",
        "answer": "Juneau",
    ]
]
</code></pre>

<p>I tried using indexOf but it does not work. My code is as follows:</p>

<pre><code>// Find index of dictionary entry with quesID of 1000
let indexOfA = questions.indexOf(1000) // Should return 0

// Find index of dictionary entry with quesID of 1001
let indexOfB = questions.indexOf(1001) // Should return 1
</code></pre>