Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Object-Oriented Swift 2.0 Complex Data Structures Methods

at 04:10 the instructor writes that he wants to return a array of type "point" i don't understand this

as point is the name of the struct

Ghaith Ali
Ghaith Ali
3,134 Points

well an array can have any kind of objects inside it, we are used to have array with objects of type Int for example, the syntax is something like this: var numberArray : [Int] this way we are making the numberArray array with objects of type Int inside it. now as mentioned we can make structs Point like we made in the video. Now we can make an array with objects of type Point like this: var PointArray : [Point] the array PointArray have objects of type Point (Point is a structure). Hope my answer made sense. :)

1 Answer

Josue Gisber
PLUS
Josue Gisber
Courses Plus Student 9,332 Points

First you need to understand the definition of a struct. With a struct you can create a data type like the primitive type: Strings, Numbers, you named it. That's why he said he wants to return an array of type Points, because he created a data type of type Point. But first you need to understand the definition of structure.