Reply to post:

Swift tailored for Windows no longer folklore: Apple's programming language available for Microsoft OS

anononononono

Optionals (marked by ?) are discouraged in swift, which I like, but there's still a lot of them around, especially in UIKit

Using it in that context will return the title of the rootViewController if the rootViewController is present, or nil and won't fail.

You could replace ? with ! to force unwrap, but that will crash at runtime should the rootViewController be unset.

I prefer to use guard let to unwrap the optional if it's present and proceed through the code

I actually like this *quirk*, and it's pretty strict on types too, I wasn't a big fan of Swift for a long time and still liked my Obj-c, but having just delivered a project using swift 5+, written in a very short amount of time I'm very much converted. It's much harder to write bugs into your code unless you really try, and has a lot of improvements over obj-c. That project is published and has only had 1 type of crash related to my code, where I went around Swifts warnings about playing with unsafe mutable data, now fixed.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon