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 calculator

Hello, I'm building a calculator in swift... I want add pi and comma when I do this it gives me an error..

How do I do this?

Thank you

Code:

@IBAction func btnPiPressed(_ sender: UIButton) {

}

@IBAction func btnDecimalPress(_ sender: UIButton) {

}
Martin Wildfeuer
Martin Wildfeuer
Courses Plus Student 11,071 Points

Hey there! Please let us know what the error is. :) does it crash? Can you give us the console output to this error? Thanks!

2 Answers

In the Pi function I tried this: handleInput(M_PI), cannot convert value of type 'double' to expected argument type 'string' I understand the error but just don't know how to fix it....

For the comma function I tried lots of different things but at all the comma button isn't doing anything in the simulator.

Pretty hard to explain, I hope this is enough info

Thank you

Can somebody please give me an answer?