From the documentation for Sequence.withContiguousStorageIfAvailable(_:)
This method calls body(buffer), where buffer is a pointer to the collection’s contiguous storage. If the contiguous storage doesn’t exist, the collection creates it. If the collection doesn’t support an internal representation in a form of contiguous storage, the method doesn’t call body — it immediately returns nil.
I'm looking at the second sentence versus the third. What is the line between synthesizing storage or giving up for a type that doesn't naturally use contiguous storage, since any type that qualifies for sentence 3 could do sentence 2 instead.
Some types can represent the same value using one of two or more different internal representations. As an example, a String might be bridged from Objective-C, or it might be a small string that uses the small string representation. As another example, in early versions of Swift, Array was not guaranteed always to be contiguous (hence, ContiguousArray as a distinct type).
This API says that contiguous storage will be created if it doesn't already exist, and then body will be invoked with a pointer to that storage. Unless, of course, a particular collection type has no possible internal representation for the value in contiguous storage. Then, no such contiguous storage will be created, because none can be created.