How to show all the elements of an array in swift?

My personal favorite for debugging purposes is dump() which also prints which index the element has. Perfect if you have arrays within an array too.

var array = ["Chinese", "Italian", "Japanese", "French", "American"]
dump(array)

This will generate the following output

▿ 5 elements
  - [0]: Chinese
  - [1]: Italian
  - [2]: Japanese
  - [3]: French
  - [4]: American

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)