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 Swift Functions and Optionals Optionals Optional Chaining

Do not see the option of Int? toInt() for optional chaining video

For the Optional Chaining video, he selects Int? toInt() after culprit. I do not see Int? toInt() in my options for the Xcode i'm using. I'm using the latest version.

Btw, how do I post a picture to the discussion page?.... wait can u see my image below?

alt text

1 Answer

Jhoan Arango
Jhoan Arango
14,575 Points

Hello there :

As of swift 2.0 toInt() is no longer being used. Instead you can use Int().

var stringNumber = "100"
var stringNumberToInt = Int(stringNumber)

There is a new problem. I updated Xcode and now I no longer get a long list of options that displays Int(stringNumber) as well as other options. Please help thanks!