This initializer was the source of an extremely difficult to track down bug in my project.
The gotcha is of course that if you initialize a class instance in the repeating initializer, every element in the array is just a reference to the same object.
Has anyone else fallen victim to this? Maybe we could mention this in the docs if it's a common issue?
/// Creates a new collection containing the specified number of a single,
/// repeated value.
/// Here's an example of creating an array initialized with five strings
/// containing the letter Z.
/// let fiveZs = Array(repeating: "Z", count: 5)
/// // Prints "["Z", "Z", "Z", "Z", "Z"]"
/// - Parameters:
/// - repeatedValue: The element to repeat.
/// - count: The number of times to repeat the value passed in the
count must be zero or greater.
@inlinable public init(repeating repeatedValue: Element, count: Int)