Congratulations to the Swift team on releasing a 1.0 GM! Unsurprisingly, there were no changes that I could spot1 between beta 7 and the GM standard libraries.
But as they said in their blog post, “Swift will continue to advance with new features, improved performance, and refined syntax. In fact, you can expect a few improvements to come in Xcode 6.1 in time for the Yosemite launch.” As such, the first beta of Xcode 6.12 saw more changes to the standard library than we saw in the pre-1.0 beta, and here they are:
- As flagged in the release notes, all the integer types have acquired
truncatingBitPatterninitializers for each of their larger counterparts.
- The functions
sortedhave acquired descriptions in the various places they’re implemented.
HeapBufferStorageno longer inherits from
HeapBufferStorageBase, which is gone.
Processinstance is now declared with
StaticStringnow has a
start(which still returns an
UnsafePointer). It also has a
withUTF8Buffermethod for using the underlying raw buffer, a
Stringhas lost its
Stringalso now implements several methods extending
StringInterpolationConvertible– for a variety of different built-in types.
- Second versions of
fatalErrornow take a generic
startsWith‘s predicate functions have been renamed
minElement‘s input parameter has been renamed
toStringfunction now says it returns the result of
debugPrinting, an object.
There’s a new
unsafeAddressOf function that takes an
AnyObject. Apparently there’s “not much you can do with this other than use it to identify the object”.
There is a new protocol,
UnicodeScalarLiteralConvertible, that follows the now-familiar literal converter pattern: a
ThingType typealias, a
convertFromThing class function, and a library-level typealias for
ThingType for the standard type for these literals to convert into, in this case a
ExtendedGraphemeClusterLiteralConvertible protocol now inherits this protocol, so the objects that implement it (
StaticString) also now implement
convertFromUnicodeScalarLiteral. And the
UnicodeScalar struct now implements
UnicodeScalarLiteralConvertible instead of
Here’s looking forward to more enhancements as Swift continues to develop.