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!
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
Chris Shei1,827 Points
Help understanding the answer to playlist code challenge 6602 (I think?)
Why do i need to unwrap the value obtained from the dictionary? I don't see an optional.
Why do I need the 'named' part?
Where can I read / learn more about how 'as' is used?
let profileImageName = friends["profilePicture"] as String!
let profilePicture : UIImage = UIImage(named: profileImageName)
Richard Lu20,185 Points
To learn more about how 'as' is used, you can take a look at Apples documentation in regards to type casting. Here's a link to the referenced document.
What you're looking for specifically is under the downcasting section. I hope I've helped. Happy Coding! :)