1 min readJun 3, 2019
If the collection conforms to Random Access Collection, then the count is O(1).
For example, a random-access collection’s count
property is calculated in O(1) instead of requiring iteration of an entire collection.
https://developer.apple.com/documentation/swift/randomaccesscollection