Force Unwrapping Swift Optionals: Code Smell!

Do you find your Swift code riddled with !‘s? I’m becoming more and more uncomfortable with seeing ! throughout my Swift code. It’s just a matter of time before it’s going to bite me. Often, I do it because it’s the “easy thing” to do at the time. But it’s dangerous. Swift optionals are trying […]

Swift Optionals? Don’t Forget to Unwrap!

There is a compiler error that throws me off every time I see it.  It takes the form, ‘ClassName?’ does not have a member named ‘memberName’ This can happen when you’ve declared a variable as an optional, but forget to unwrap that optional when you attempt to call a method on it. For example, given this […]