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 trialnicolasmanient
482 Pointscannot assign a value of type "string!" to a value of type "string?"
I have some error in my code :
title = playlistDictionary["title"] as! String!
cannot assign a value of type "string!" to a value of type "string?"
I tried many possibilities but i don't find the solution :(
2 Answers
bos anac
149 PointsHaving the same problem. Hopefully someone knows the answer! :)
thomas lotocki
3,230 PointsThis syntax works on my end no probs:
title = playlistDictionary["title"] as! String!
Sean Mateer
9,330 PointsSean Mateer
9,330 PointsI've been having some problems here as well. The error goes away if I use the following syntax, though I'm not entirely sure it's correct
title = playlistDictionary["title"] as? String
It seems as though swift has made some updates since this video was made. I'm on xcode 6.3.2.