News

July 9, 2018

Swift 4.2

SwiftDoc has been updated to include information about the following Swift versions: 4.2, 3.1, 3.0, 2.2, and 2.1.

August 25, 2015

Swift 2.0b6

Xcode 7 beta 6 brings more changes to the standard libraryscape:

  • The free function slaughter continues. The newest release guts the remainder of the free functions, moving nearly everything possible into a protocol extension. Left alone, abs() whistles pointedly, refusing to make eye contact with SignedNumberType or AbsoluteValuable. Its days are numbered.

  • The Lazy* group of types and protocols have been updated significantly, with clearer naming and official protocols for LazySequenceType and LazyCollectionType.

  • MutableSlice, MutableIndexable, and ReverseIndexType all join the family to support new mutable collection slicing capabilities. Welcome, everyone!

  • Many methods that take closures, like map, filter, and contains, are now marked as rethrows, so they can accept throwing closures and pass on any thrown errors.

July 21, 2015

Swift 2.0b4

Xcode 7 beta 4 is available today with the latest revision to Swift 2.0. Along with indirect enums, beta 4 includes some significant changes to the standard library, including:

  • The protocol hierarchy for sequences and collections has been overhauled, with subscripting moved from CollectionType to a new Indexable protocol. This change, along with the addition of a SubSequence type alias inside CollectionType, sees the end of the Sliceable protocol and the introduction of a new Slice struct that can be based on any indexable instance.

  • As noted in the release notes, SinkType and SinkOf are now gone, being replaced by (T) -> () closures in the few relevant functions and methods.

  • The list of free functions is getting leaner and leaner as functions move into protocol extensions. The extensible and range-replaceable collection have shuffled off their mortal coil this time (along with ExtensibleCollectionType itself).

March 27, 2015

Updated for Swift 1.2b4

Swift 1.2 beta 4 is out with the latest version of Xcode 6.3. The only real change you’ll see here is revised documentation for assert, assertionFailure, fatalError, precondition, and preconditionFailure.

March 12, 2015

Updated for Swift 1.2b3

Swift 1.2 beta 3 brings some more changes to the standard library.

  • Slice has been rechristened as ArraySlice, likely to signify its relationship with Array and ContiguousArray.

  • A global flatMap function has been added for both optionals and sequences, and flatMap methods have been added to the optional and array types, much to the joy of functional-leaning Swifters everywhere. For sequences and arrays, this provides a way to map each element to an array, with the resulting array of arrays flattened back to an array of their joined elements:

    
    let numbers = [1, 2, 3, 4]     
     
    let expanded = numbers.flatMap { Array(count: $0, repeatedValue: $0) }
    // flatMap flattens the result:
    // [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]
    
    let nested = numbers.map { Array(count: 0, repeatedValue: $0) }
    // with map, you end up with a nested array:        
    // [[1], [2, 2], [3, 3, 3], [4, 4, 4, 4]]
    

    For optionals, flatMap lets you safely call functions that don’t take an optional value without going through an optional binding:

     
    let squareRootOfLast = expanded.last.flatMap { sqrt(Double($0)) }
    // Optional(2.0)
    
  • Swift 1.2 beta 2 saw the addition of a new unsafeUnwrap function, the disappearance of the &/ and &* operators, and the arrival of UnicodeScalar.UTF16View. (I forgot to post the release notes last time. But they were short.)

February 10, 2015

Major content update for Swift 1.2

Big changes afoot in this release! To wit, a high-level look at what’s in and what’s out:

Types

  • A new collection type, Set, joins Array and Dictionary, bringing along with it SetIndex and SetGenerator.
  • We bid adieu to HeapBuffer, HeapBufferStorage, and OnHeap, while welcoming ManagedBuffer, ManagedBufferPointer, and ManagedProtoBuffer. ♫ Make new friends, but keep the ooooold…
  • Process has changed from a global variable to an enum with static properties, clearing out the only globally scoped variables.
  • NonObjectiveCBase comes on board to help with uniquely identifying instances of reference types.
  • String has had some reorganizing, with String.UTF16View losing Int subscripting as it gets its own Index.

Protocols

  • Most of the action in protocol additions/removals/renamings has been in the underscore-prefixed, stdlib-internal, unsupported group of protocols. In general, _SwiftNS* lose the Swift and *RequiredOverridesType map to *CoreType.
  • Several other _* protocols are now visible: _ArrayType, __ArrayType, _DestructorSafeContainer, _PointerType, _StringElementType, and, coming to CBS this fall, the mysterious new action drama _ShadowProtocol.

Functions

  • countElements is now simply count, which count("countElements") - count("count") tells us is a savings of eight letters.
  • isUniquelyReferenced and isUniquelyReferencedNonObjC have been brought up from the internal stdlb, making it possible to implement third-party copy-on-write behavior.
  • zip provides functional access to the Zip2 type.

Updated to Swift version 1.2 (swift-602.0.37.3).

January 22, 2015

Minor update

  • Sorted the operator listing so the order will be consistent for future Swift versions.
  • No changes, but updated to Swift version 1.1 (swift-600.0.57.3).

January 3, 2015

Swifter is now SwiftDoc.org

I’m excited to announce some big changes to Swifter today. The first, as you can see from your address bar, is that the site is now SwiftDoc.org. The change in name is meant to mark the beginning of a process: to give the Swift community a site that is both more useful and one we can all be involved with.

To that end, I’ve put the code for the parser/builder that converts the Swift header file into this site, and the code to the site itself, in repositories on GitHub. Moreover, the site itself is now hosted via GitHub Pages. Plans are in the making for the coming weeks that will involve, you, Gentle Reader, so watch this space.

In addition, this release comprises the following changes:

  • Nested types are hoisted to the top-level, e.g. String.Index.

  • Now includes ContiguousArray’s join method, due to its one-of-a-kind nested generic term. Bet you’re glad to see that one.

  • Two new protocols are visible: ArrayType and _ArrayType. These are from the internal Swift header file and neither visible nor accessible to us while programming in Swift. They’re included here to connect Array and Slice to other protocols like RangeReplaceableCollectionType.

  • The String initializers that import Foundation adds are now listed, since Foundation is nearly always imported anyway. These initializers are marked with “[Foundation]”, like so:

init(format: String, locale: NSLocale?, _ args: CVarArgType...)

[Foundation] Returns a String object initialized by using a given format string as a template into which the remaining argument values are substituted according to given locale information.

September 30, 2014

Updated for Swift 1.1b3

This update includes loads of new documentation from the good people at Apple. Array in particular has info about bridging with NSArray that I haven’t seen anywhere else.

September 13, 2014

New feature: Inheritance hierarchy graphs

The graphs show all the protocols that a type conforms to, or all the types that conform to a protocol. Examples: Int, Array, CollectionType.