Arrays are useful for storing ordered sets of data. An array in Swift stores values of the same type in an ordered list.

The same value can appear more than once in an array, each at different positions.

Create an empty array of Integers (note the square brackets)

Or an array of strings:

Now if we want to add a value to these arrays, it’s easy peasy!

Of course we don’t have to always add values like this. We can pop them in at the start:

How about counting numbers of elements in an array?

How about getting elements themselves?

And if we access an element that doesn’t exist?

That’s arrays in a nutshell. There are tons more functions but once you know the basic structure the rest is easy!

Where to go Next

This tutorial comes straight out of The Complete iOS Developer Course. Over 40 hours long it contains everything you need to create awe inspiring apps fast!

Click here to check it out!

Arrays in Swift 3 Explained

Leave a Reply

Your email address will not be published. Required fields are marked *

Share This

Want this Post in Easy to Understand Video Form?

Then get the Complete iOS Developer Course. Over 50 hours of pure Swift coding goodness designed to turn you into a coding master!

One Time Offer - $9! Click to Get it!

WARNING: Once this box is closed the offer will not be shown again.

Thank you!