Great video! I’m building an app revolving around a calculator, now I know it shouldn’t be as expensive as I thought because this is an easy coding process lol.
Thank you Cal!!!! Just wanted to say I really appreciate the succinct and straight-to-the-point style you have, as someone with the attention span of a gold fish, I respond to short videos so much better, honestly learned more from this 10-min video than long lectures
Thank you for the video, this has been a nice experience! A quick question, who did you write the backspace character as an icon? I have been trying to do that but wasn't able to achieve it.
First, thanks for the demonstration. Very helpful video for the tutorial. Maybe I mistaken somewhere but divide operator resulting with integer and not giving the exact result. For ex. 15/2=7
I've been learning iOS development for a few months now and it's going well. What's the best way to start learning and memorizing all these available types' properties and methods? Thanks in advance.
My advice would be not to try and memorize anything really. Good developers know what's possible and how to find out how to do it when the time comes. There will be things that you do so often the you do memorize it. But that happens naturally in my experience. Good luck with the iOS development.
Hey Cal, just a quick question. When I try to change the background colour of my stack view, nothing happens. Is there a reason and how can I fix this?
Hi, could be a couple of different things. Background color changing should generally just work though, never the less here a few things to check. 1- double check you are indeed changing the right stack views background color via the attributes inspector. 2 - make sure there is nothing in the story board overlaying and covering your stack view. 3 - Stack view has some position constraints so its not lost to the side or too small to see. Hope this helps.
@@MNSB1 If you would like to. No pressure. Using quick time you can record your screen. Make a quick recording and email me at calsappdev@gmail.com I'll have a look :)
You squeezed 1 hr tutorial in 10 mins :). Anyways, good for a quick start. As to check for the validity of an expression, I would rather stop a user at entry point and would not let him add operators together
Hi, cal. I have some problems. The 5, 8, 6, and dot buttons do not work. That's why the code in the appDelegate part gives an error. But the other buttons work. I don't know how to solve this problem.
@@CodeWithCal func formatResult(result: Double) -> String { if(result.truncatingRemainder(dividingBy: 1) == 0) { return String(format: "%.0f", result) } else { return String(format: "%.2f", result) } } how could one edit this so that when I divide, for example, 5 and 7 it will spit out 0.71? Any help would be much appreciated
That is what's happening correct? We are saying if the result is a full number print 1 for example And if there is a decimal print 1.17 etc. 5/7 the formatted result should be 0.71 :)
Absolutely. Check out this video I made regarding user defaults. You could add a settings page to allow the user to choose the theme. ruclips.net/video/Hf_sianDJWY/видео.html
Hmm 🤔 so it's probably not liking two equals signs next to each other. try looping through the string to check if two equals signs are next to each other.
Couldn't you just create a single IBAction for a button and make it read values from text? That would be so much easier and less code, at least for numbers
@@HFYBook stackoverflow.com/questions/3088059/xcode-how-to-fix-nsunknownkeyexception-reason-this-class-is-not-key-valu Looks like there could be a bad connection in your xib this stack overflow article explains well I believe :)
bro what's the rush? the tutorial is too fast. this is not good for beginners. Im trying to get my hands on xcode to try out my first mobile app and all im seeing is u clicking here and there like a maniac
Great video! I’m building an app revolving around a calculator, now I know it shouldn’t be as expensive as I thought because this is an easy coding process lol.
Wz RSA Z W s
Thank you Cal!!!! Just wanted to say I really appreciate the succinct and straight-to-the-point style you have, as someone with the attention span of a gold fish, I respond to short videos so much better, honestly learned more from this 10-min video than long lectures
Awesome. Glad you liked it :)
Thank you so much for this video, it helped me a lot to start making interfaces using Storyboards 🤓
Great tutorial !! Truly appreciate it 🙏🏽
Awesome Video!!!!!!!!! I had to put the speed of the video on 0.5 to follow, but great stuff man. Thanks!!!! Got a new subscriber 😉
Thanks, Glad you liked it :)
Я тоже смотрела на скорости 0,5 😅😅
@@KseniyaKhakimova 😂😂😂
Thank you for the video, this has been a nice experience! A quick question, who did you write the backspace character as an icon? I have been trying to do that but wasn't able to achieve it.
just asking can you please reply to this comment with that backspace x icon that you used in your video for the x button
Sure thing
⌫
How did you add the back tap button on the calculator?
Copy pasted the character from the internet. :)
@@CodeWithCal Thank You
hii I have a question,how to make it impossible to divide by zero ?
Hey I have a question so when i put 1 / 2 for example instead of returning 0.5 it always returns 0 anything would help :)
Nice video thank u. My question is 6/4 = 1 u should write 6/4.0 for correct answer 1.5
thank you so much for the video!! How can I add a 3-character split? When I enter 10000000 and the screen shows 10 000 000, or 1000 -> 1 000?
try putting this outside of view controller class
extension Double
{
func round(to places: Int) -> Double
{
let divisor = pow(10.0, Double(places))
return (self * divisor).rounded() / divisor
}
}
extension Formatter
{
static let withSeparator: NumberFormatter =
{
let formatter = NumberFormatter()
formatter.numberStyle = .decimal
formatter.groupingSeparator = " "
return formatter
}()
}
extension Numeric
{
var formattedWithSeparator: String { Formatter.withSeparator.string(for: self) ?? "" }
}
Now using the extensions in previous comment, our format result can look something like this:
func formatResult(result: Double) -> String
{
var roundedResult: Double
if(result.truncatingRemainder(dividingBy: 1) == 0)
{
roundedResult = result.round(to: 0) //return String(format: "%.0f", result)
}
else
{
roundedResult = result.round(to: 2) //return String(format: "%.2f", result)
}
return roundedResult.formattedWithSeparator
}
@@CodeWithCal Super! It's working! But I want the 3-character split to be displayed also when I enter the calculation. For example 1_000+2_000 ...
Simply use a for loop with a counter.
hey, can someone help me with the documentation of this program using markdown?
Thank you so much
Very good tutorial.. Very helpful for me... Thanks a lot❤
Glad it was helpful!
amazinnngggggggggggggg its blow my mind
u created in just 10 min i was struglling from 3 hour,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,respect
🌐
😁
After starting the application and rotating the screen, all Constraints are removed and turn to mush.
First, thanks for the demonstration. Very helpful video for the tutorial. Maybe I mistaken somewhere but divide operator resulting with integer and not giving the exact result. For ex. 15/2=7
workings = workings.replacingOccurrences(of: "/", with: "*1.0/")
let checkedWorkingsForPercent = workings.replacingOccurrences(of: "%", with: "*0.01")
let expression = NSExpression(format: checkedWorkingsForPercent)
let result = expression.expressionValue(with: nil, context: nil) as! Double
let resultString = formatResult(result: result)
calculatorResults.text = resultString
@@navedkhan6643 thank you!
I've been learning iOS development for a few months now and it's going well. What's the best way to start learning and memorizing all these available types' properties and methods? Thanks in advance.
My advice would be not to try and memorize anything really. Good developers know what's possible and how to find out how to do it when the time comes.
There will be things that you do so often the you do memorize it. But that happens naturally in my experience.
Good luck with the iOS development.
Why does it crash when I just punch in equals?
Hey Cal, just a quick question. When I try to change the background colour of my stack view, nothing happens. Is there a reason and how can I fix this?
Hi, could be a couple of different things. Background color changing should generally just work though, never the less here a few things to check.
1- double check you are indeed changing the right stack views background color via the attributes inspector.
2 - make sure there is nothing in the story board overlaying and covering your stack view.
3 - Stack view has some position constraints so its not lost to the side or too small to see.
Hope this helps.
@@CodeWithCal it seems as though it is still not working. I have checked it a million times and I have no idea.
@@MNSB1 If you would like to. No pressure.
Using quick time you can record your screen. Make a quick recording and email me at calsappdev@gmail.com I'll have a look :)
@@CodeWithCal I wasn’t able to send a screen recording but I was able to record and send it on my phone
@@MNSB1 Hey! Did you ever manage to fix this? I encountered the same problem and can't seem to fix it :)
thank you very much :D
You are most welcome 🙂
Excellent code simply awesome
You squeezed 1 hr tutorial in 10 mins :). Anyways, good for a quick start. As to check for the validity of an expression, I would rather stop a user at entry point and would not let him add operators together
Hi, cal. I have some problems. The 5, 8, 6, and dot buttons do not work. That's why the code in the appDelegate part gives an error. But the other buttons work. I don't know how to solve this problem.
How did you go?
Love the tutorials!
Thanks :)
@@CodeWithCal
func formatResult(result: Double) -> String {
if(result.truncatingRemainder(dividingBy: 1) == 0) {
return String(format: "%.0f", result)
} else {
return String(format: "%.2f", result)
}
}
how could one edit this so that when I divide, for example, 5 and 7 it will spit out 0.71? Any help would be much appreciated
That is what's happening correct?
We are saying if the result is a full number print 1 for example
And if there is a decimal print 1.17 etc.
5/7 the formatted result should be 0.71 :)
@@CodeWithCal still not working. I must have an error somewhere else in my code. I will double check your source code! Thanks for the speedy reply!
Can you do a setting in a calculator that can change the background, font of text, and the background color.
Absolutely.
Check out this video I made regarding user defaults. You could add a settings page to allow the user to choose the theme.
ruclips.net/video/Hf_sianDJWY/видео.html
man i just want a similar calculator app for ios
super low quality tutorial, i barely have experience with xcode, and this tutorial didn't help much to understand more of the program.
Can u pls help me when I press = without any input the app will crash
What does your error message say?
Check the validInput() function. that should be checking well to see if there is valid input :)
@@CodeWithCal it says "unable to parse the format string \" ==1\""
Hmm 🤔 so it's probably not liking two equals signs next to each other. try looping through the string to check if two equals signs are next to each other.
thanks
when I run my app in the simulator it shows me a white screen, why?
and please help me
hmm could be a number of reasons. But most likely something has gone wrong with the set up of your storyboard. Any more details you can provide?
@@CodeWithCal If you have a email I can send images of the error
@@keshavrawat6575 calsappdev@gmail.com
i love it , nice work , i but i tried to do it but i got many errors :D
Thanks. You can do it :)
what is this "%" character doing here is not clear.
Couldn't you just create a single IBAction for a button and make it read values from text? That would be so much easier and less code, at least for numbers
You could absolutely. Lots of ways to skin the cat as they say
Threat 1: fatal error: UNEXPECTED FOUND NIL WHILE IMPLICITLY INWRAPPING AN OPTIONAL VALUE…….. this error is coming while running the program…
Plz help
UNEXPECTED FOUND NIL WHILE IMPLICITLY INWRAPPING AN OPTIONAL VALUE
The error message says it all 😜
hey guy why are you do speedrun
Yeah I can get carried away with speed 🚅
can I contact with you??
Sure thing.
calsappdev@gmail.com
you are CAL EL
Hey can you help me out please?
Hey sure thing. what's up?
@@CodeWithCal Thread 1: "[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key calculatorworkings."
I kept getting this error
@@HFYBook stackoverflow.com/questions/3088059/xcode-how-to-fix-nsunknownkeyexception-reason-this-class-is-not-key-valu
Looks like there could be a bad connection in your xib this stack overflow article explains well I believe :)
@@CodeWithCal thank you!
lol slow down.
bro what's the rush? the tutorial is too fast. this is not good for beginners. Im trying to get my hands on xcode to try out my first mobile app and all im seeing is u clicking here and there like a maniac
Point taken, I can go a little fast. Some people like the pace some people don't haha. Good luck, hope you enjoy your programming journey.
@@CodeWithCal nevertheless i still managed to complete your tutorial. it was enjoyable. but hope it was bit slower.
you talk too fast...
Yeah I got a bit carried away, Thanks for the feedback.
@@CodeWithCal not too fast
WORTHLESS !!!
Strong words. I'm open to constructive criticism. What didn't you like about the tutorial?
Ik having answer 0 every time🥲