1

I get the following errors when trying to create a multidimensioanl array dynamically:

Incorrect argument labels in call (have 'count:repeatedValue:', expected 'unsafeUninitializedCapacity:initializingWith:')

Replace 'count: languageCount, repeatedValue' with 'unsafeUninitializedCapacity: languageCount, initializingWith'

and when I accept the auto correction suggestion, I then get:

Cannot convert value of type '[Any]' to expected argument type '(inout UnsafeMutableBufferPointer<_>, inout Int) throws -> Void'

which doesn't offer a fix button.

I don't understand these errors.

let numColumns = wordsInLanguageCount.max() ?? 0
let numRows = languageCount
var tableViewWords: [[Int]] = Array(count: languageCount, repeatedValue: [])
1
  • What's languageCount? Commented Sep 4, 2019 at 1:36

1 Answer 1

2

For me the following runs without error on Swift5

let languageCount = 10    // This is an Int
var tableViewWords: [[Int]] = Array(repeating: [], count: languageCount)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.