Xcode 7.3 b2, Swift 2.2
The bug fixes continue to come flooding in. As always, get the full details in the official release notes.
Swift 2.2
- Failable and throwing initializers can both exit before initializing all stored properties or calling
super.init()
- Nested C structs now import as nested Swift structs
@objc
is now valid on enums and enum cases so you can control the generated name- Tuples (with up to 6 items) that have
Equatable
orComparable
items are themselvesEquatable
orComparable
. See here. - The operator grammar was relaxed slightly. If an operator starts with a dot it can contain other dots, but otherwise it cannot contain any dots.
Documentation Comments
- keyword:
allows you to specify "other concepts".- recommended:
lets you specify alternative declarations that users of an API should prefer- recommendedover:
the inverse of- recommended:
; this declaration is preferred over the listed alternatives.
Deprecations & Removals
If you've been following swift-evolution none of this is surprising but the following things have been deprecated and will now generate warnings.
- Curried function syntax
++
and--
- C-style
for init; criteria; increment
loops - The global
anyGenerator
functions are now initializers onAnyGenerator
(as they always should have been)
Fixes
- Closures inside generic types and methods can be used as C function pointers if the closure doesn't reference any generic arguments; if it does you'll now get a useful error instead of a crash.
- If a framework incorrectly uses unqualified
#import
or#include
directives (using double quotes instead of angle brackets) the compiler no longer barfs with the dreaded "non-modular header inside framework" error. - The static analyzer has several fixes related to Objective-C generics and nullability attributes
- 🎉 Code Completion 🎉
- Matches on typing just the upper-case letters of method names. No more hunting around for the specific
UITableViewDelegate
function you're looking for! - Matches on substrings, so
color
brings up properties likebackgroundColor
andtintColor
- Matches on typing just the upper-case letters of method names. No more hunting around for the specific
Xcode, Debugging, and Misc
- LLDB now automatically imports the appropriate modules for the debugging context so there's no need to
e @import UIKit;
just to get the debugger to work properly. I still consider it shameful that this basic functionality was completely broken for so long. - View Debugging (Debug, View Debugging, Capture View Hierarchy) has a ton of improvements; check out the release notes for more information.
Known Issues
- Nested types can cause compiler crashes if the nested type is referenced elsewhere in the same module; the recommendation is to use Whole Module Optimization or avoid nesting types for the moment.
fin
It's been a very busy time personally and I've been a bit absent from writing. Rest assured I have several posts in the pipeline that should see the light of day soon, including:
- A Swift Hypervisor
- UIKit Popover Adaptability: the Good, the Bad, and the Ugly (hint: it's all Ugly)
- Functors, Applicatives, and Monads in Plain English
- CoreImage, GL Shader Language, and Quartz Composer: Oh My
- ReactiveCocoa: The 15 Minute Guide
- Swift Associated Types, Round 2
If you have a preference on which you'd like to see next please leave a comment or send me a tweet.
This blog represents my own personal opinion and is not endorsed by my employer.