how to access elements in a 2D Array in Swift
问题 I am trying to read string variables from a single array (or more precisely from an array of arrays of strings , as clarified in the accepted answer) in Swift. The following reads the entire array. var array = [["W", "X", "Y", "Z"], ["A", "B", "C", "D"]] print(array[0],array[1]) How do I read a pair of variables, e.g. "X" and "D" ? 回答1: array is an array of arrays of strings. Or, type Array<Array<String>> . array[0] will return the first element of the array, which is an array of strings, or