john doe john doe - 1 year ago 103
Swift Question

Conditional Binding for Optionals

I have the following code and it complains about the as! keyword. If I replace with as? it works fine.

enter image description here

Answer Source

You can't do force unwrapping in guard or if let. Use optionals. The end product which is name in your case is already an unwrapped value for you.

Replace as! with as?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download