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 Value vs Reference Types Final Exam - Solution

Andy Warr
Andy Warr
2,417 Points

sqrt not working for me in Xcode?

I got through this final exam just fine, except Xcode is returning a "Use of unresolved identifier 'sqrt'" error in my set method.

I believe I used the correct syntax:

set { sideLength = sqrt(newValue) }

I can also use any other operators to come up with a different answer for the sideLength, which of course does not return the correct value, but the code works. Everything else in my code checks out with the solution video.

Anyone else seen this?

2 Answers

Andy Warr
Andy Warr
2,417 Points

Ah, never mind. I had accidentally deleted the

import UIKit

statement from the top of the playground. Will leave this up in case anyone else has this problem, unless the mods see fit to take it down.

Jarrett Young
Jarrett Young
12,635 Points

I'm getting the exact same error message, and I have the import UIKit statement at the top.