What’s an Array Made Of?
It is possible to inspect the entire Swift programming language in XCode so you can see exactly how it was created. You should take advantage of this as often as possible. It will teach you how Apple likes code structured, and you will learn how to effectively use different types. To see how to do this, in this section, you’ll take a look at an array. You won’t understand most of the syntax right now, but we will come back to it later, and I promise that it will all become clear to you. In the playground, write this line of code:
var a:Array<Int>
This declares a variable that is an array of Ints. In fact, you can write any type in place of Int. This is because Array is declared using generics, which you will learn all ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access