Arrays

Thing to learn

Overview

  • Groups data with square brackets "[]"

  • Indexes items from "0"

  • It might be let or var

  • It should contain one particular data type, whether it is string or number

Data Types

  • String

  • Integer

  • Double

Swift knows the data type of the array.

Arrays cannot mix multiple data types.

arrayName<datatype>(): Creates an empty Array with defined data type

Actions

  • Add: arrayName.append

  • Find: arrayName[indexnumber]

  • Count: arrayName.count

  • Sort: arrayName.sorted()

  • Sort-Reverse: arrayName.reversed() // It dows not work as expected. #learn

  • Check: arrayName.contains("itemName")

Sample Codes

Removing or Appending a record to an Array

Counting

Sources

Videos

Articles / Documents

See Also

Last updated

Was this helpful?