Creates a new collection containing the specified number of a single, repeated value.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
Parameters
repeatedValue
The element to repeat.
count
The number of times to repeat the value passed in the
repeating
parameter.count
must be zero or greater.
Discussion
Here’s an example of creating an array initialized with five strings containing the letter Z.