iosswift5array-initialization

Don't understand "Extra argument 'repeatedValue' in call"


What could be wrong with:

let myArray = [UInt](count: 256, repeatedValue: 0)

that leads to the error Extra argument 'repeatedValue' in call?

I found this in existing code I'm adding to my Swift 5 app.


Solution

  • This is not Swift 5. The initializer name is init(repeating:count:) since Swift 3.