I am writing a function that deletes a search from an apps NSUserDefaults. The method removes the deleted search from the searches Dictionary. I am confused about the syntax of this function. I don't understand how we access the value of the searches Dictionary with the searches[tags[index]]. To access the value at that index of the searches Dictionary wouldn't we just say searches[index] ?
private var searches: Dictionary <String, String> = [:] // stores tag-query pairs
private var tags: Array<String> = [] // stores tags in user-specified order
// returns the query String for the taga at a given index
func queryForTagAtIndex(index: Int) -> String? {
return searches[tags[index]]
}