What is the difference between NSArray and Array ?

Tejal Chaudhari
1 min readOct 5, 2021

NSArray

  1. NSArray is hold different types of data where you can store double, string, float, custom object etc.. or you can store element of different data types.
  2. NSArray is immutable. It means object state can’t be modified after it is created.
  3. It’s reference type. It means two variable point to the same address in memory so if you make change or perform operation in one variable , it will automatically reflect on another variable. Because both variable refer same object in memory.

Array

  1. Array is hold same types of data. It means at a time you can store only one type of data.
  2. Array is mutable. It means liable to change or object can be modified after it it is created.
  3. Array is value type. It means each variable has its own copy of data so operation on one variable can’t affect on the other variable of same array.

--

--

Tejal Chaudhari

Enthusiastic iOS Engineer I write about Swift UI, Swift programming language and iOS development.....