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 Classes in Swift Helper Methods

Rich Braymiller
Rich Braymiller
7,119 Points

Helper Methods

I am pretty lost...to be honest, I think they could have come up with a much simpler example which builds on itself...but it doesn't...as a beginner this is very difficult and this guy obviously isn't good at teaching, he just teaches. SMH

Murat Kuru
Murat Kuru
1,909 Points

I agree. This example is way to complicated for a beginner!

Allen Soberano
Allen Soberano
13,634 Points

I understand the frustration. Although not a complete beginner, I have created a few apps on the app store, the deeper you go into classes, the more confused you may get. If you followed along from the beginning of Learning Swift he has gone over each concept that he speaks about in this video. I was confused as heck as well.

I found downloading the project file and opening it in playground, helped me understand it better. As well as watching the video several times.

I started to get a little lost when he did: let availablePositions = position.points(inRange: range)

I was wondering where did those types come from and how can he access them. However after opening up the playground file that's available in the download section, I was able to see that:

position - is referencing the position in the Tower class (let position: Point) note: position has a type of 'Point'

so when he does: .points(inRange: range) He is referencing the method in the struct Point which he set as the type for position in the lines above.

I just finished watching the video and thought I might give it a go at explaining. Not sure how I did.

What might help is if you Ask 'exactly' what part of the code you can't figure out. By doing so, I have found others are able to provide better help.

All the videos up until this point have been fairly straight forward. Now you are learning where others start to get stuck as well.

Hope it helps.