How to create a swift array?

Example:


  var fruits = ["Apple", "Banana", "Cherry"]
  print(fruits[0])  // Outputs: Apple
  

Solution:

In Swift, arrays can be defined using the square brackets. You can access elements of the array using an index.

Beginner's Guide to Swift