2

My aim is to have an array of empty arrays in swift. Something like this:

[[][][][][]]

They are all of type Game. This is my attempt:

 let numberOfDays = 5
 var gamesCache: [[Game]] = [](count: numberOfDays, repeatedValue: [])

It comes up with the error. Cannot call value of non function type '[Any]'

1 Answer 1

7

Try like this way.

let numberOfDays = 5
var gamesCache = [[Game]](count: numberOfDays, repeatedValue: [])
Sign up to request clarification or add additional context in comments.

1 Comment

Swift 5: [[Game]](repeating: [], count: numberOfDays)

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.