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

Ian Rushton
Ian Rushton
15,789 Points

Key word 'as' not working the same as in these videos.

Whenever the key word 'as' has been used in these videos I have had to follow it with a '!' operator, otherwise I get an error. Is this due to an update with Xcode or is there something I am doing wrong?

Also, if this is correct, will this lead to the finished app behaving differently?

2 Answers

Marina Alenskaja
Marina Alenskaja
9,320 Points

Hi Ian

I seem to recall having the same issue. I think the reason is just that in the videos, Pasan uses Swift 1 and right now we are using Swift 2 - which is probably the reason for the difference. I did however get through all the videos without any issues when using as!

Happy coding :-)

Ian Rushton
Ian Rushton
15,789 Points

Thank you! I messed up trying to link the video I think cuz I was at work!

You've reassured me!! :) Much appreciated!!

Ian Rushton
Ian Rushton
15,789 Points

This is the video I am referring to, and the same situation occurred previously in the same tutorial.

I will link the exact code later on today on my lunch break! :)