Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chrono1081

macrumors G3
Original poster
Jan 26, 2008
8,450
4,149
Isla Nublar
Hi guys,

I'm working through the Big Nerd Ranch iOS/Swift book and there is a line where the code looks like this:
Code:
 if let text = textField.text where !text.isEmpty {
celsiusLabel.text = text
}
else {
celsiusLabel.text = "???"
}
}

My question is why is the exclamation point in front of the variable name? I see this occasionally in Swift code but have yet to find an explanation for it. If it is a force unwrap why is it up front?



EDIT: I'm so dumb. Its a "not" operator. Damn Swift and its crazy !'s everywhere had me confused.
 
Last edited:

chrono1081

macrumors G3
Original poster
Jan 26, 2008
8,450
4,149
Isla Nublar

It is but I noticed the old way of editing a title doesn't work and I can't figure out where the "Thread Tools" option is in the post you linked. I don't see it anywhere.

EDIT: Found it. Its not very intuitive. For anyone else you have to click on your post like you're going into read it normally (not using edit mode) and there will be a tiny gear at the top of the page on the right side.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.