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.
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.
If Apple's own developers are just slapping '!'s on optionals to make errors go away, I would be seriously concerned.
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.
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 !.