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
truncatingBitPattern
initializers for each of their larger counterparts. - The functions
join
,reduce
,sort
andsorted
have acquired descriptions in the various places they’re implemented. AssertString
andStaticString
are nowPrintable
andDebugPrintable
HeapBufferStorage
no longer inherits fromHeapBufferStorageBase
, which is gone.- The
Process
instance is now declared withlet
rather thanvar
StrideThrough
orStrideTo
are nowReflectable
StaticString
now has autf8Start
instead ofstart
(which still returns anUnsafePointer
). It also has awithUTF8Buffer
method for using the underlying raw buffer, aunicodeScalar
get property.String
has lost itscompare(other: String.UnicodeScalarView)
method.String
also now implements several methods extendingStringInterpolationConvertible
– for a variety of different built-in types.- Second versions of
assertionFailure
andfatalError
now take a genericAssertStringType
instead ofStaticString
. equal
andstartsWith
‘s predicate functions have been renamedisEquivalent
.maxElement
andminElement
‘s input parameter has been renamedelements
.- The
toString
function now says it returns the result ofprint
ing, notdebugPrint
ing, 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 String
.
The ExtendedGraphemeClusterLiteralConvertible
protocol now inherits this protocol, so the objects that implement it (Character
, String
, AssertString
and StaticString
) also now implement convertFromUnicodeScalarLiteral
. And the UnicodeScalar
struct now implements UnicodeScalarLiteralConvertible
instead of ExtendedGraphemeClusterLiteralConvertible
.
Here’s looking forward to more enhancements as Swift continues to develop.
Excellent summary, as always. I also found out the hard way that String no longer conforms to the Printable protocol in 6.1 beta.
[…] Airspeed Velocity: […]