ios – Are there considerable drawbacks to use Swift’s ContiguousArray? If so, which are there?

0
64


Apple’s ContiguousArray Documentation describes it as:

The ContiguousArray type is a specialized array that always stores its elements in a contiguous region of memory. This contrasts with Array, which can store its elements in either a contiguous region of memory or an NSArray instance if its Element type is a class or @objc protocol.
If your array’s Element type is a class or @objc protocol and you do not need to bridge the array to NSArray or pass the array to Objective-C APIs, using ContiguousArray may be more efficient and have more predictable performance than Array. If the array’s Element type is a struct or enumeration, Array and ContiguousArray should have similar efficiency.

To me this sounds like a ContiguousArray is always preferable to a regular Array since it has at least the same performance. Yet in my (perhaps too limited) experience with swift so far I’ve never seen anybody use a ContiguousArray instead of an Array and the description seems almost too good to be true.

I could not find any lists of drawbacks of ContiguousArrays online. I could imagine that while it is running faster, it has a less favourable memory usage than an array, but I can’t find any information backing this. Can somebody with more understanding of the matter please help me to understand if there’s a trade-off to expect when using ContiguousArrays?