News for hackers. Stuff that matters.
Re:Apple’s use of Swift in iOS 12 by dep_b on Friday September 28, 2018 @08:05AM (#18092670)
> Obviously, it's not Swift's fault for that, but even if people at Apple make rookie mistakes such as using force unwrap operator, it tells something about the language.

It's still often suggested by Xcode if you use an optional which has not been unwrapped in any way. "Click here to make error go away" adds an !.

Re:Apple’s use of Swift in iOS 12 by wool_gather on Friday September 28, 2018 @08:20AM (#18092735)
Good point. Fortunately this fixit was improved over the summer: https://forums.swift.org/t/resolved-insert-is-a-bad-fixit/10... I believe it made its way into Swift 4.2/Xcode 10.
Re:Apple’s use of Swift in iOS 12 by dep_b on Friday September 28, 2018 @08:50AM (#18092871)
Good stuff. Now to fix my only other pet peeve which is declaring IBOutlets with a ! by default. In the ideal world IBOutlets would be checked compile time unless they're declared with a ?
Re:Apple’s use of Swift in iOS 12 by wool_gather on Sunday September 30, 2018 @11:55AM (#18106676)
Well, they have to be Optionals one way or another, because they can't get hooked up until after init[0], and Swift won't allow that. But yeah, I imagine this is on someone's todo list somewhere. IB already knows whether things are connected properly, and actually so does the source editor, since it shows the little circles in the gutter.

--

[0] Unless you could invert the order of the unarchiving...not sure what difficulties that would cause.

Re:Apple’s use of Swift in iOS 12 by sgt on Friday September 28, 2018 @08:47AM (#18092855)
If Apple's own developers are just slapping '!'s on optionals to make errors go away, I would be seriously concerned.
Re:Apple’s use of Swift in iOS 12 by dep_b on Friday September 28, 2018 @08:53AM (#18092893)
Well hiring practices in the US tend to be skewed toward people knowing a ton about data structures and algorithms versus people having years and years of practical knowledge programming things. I wouldn't be surprised. I've seen Swift code built by pretty smart people that was one big exclamationfest.