I have an array with 10 objects all of the same self-created class.
let myArray = [CustomObject(), CustomObject(), CustomObject(), CustomObject(), CustomObject(), CustomObject(), CustomObject(), CustomObject(), CustomObject(), CustomObject()]
I wonder if there is a shortcut for creating such an array like in Python where I would do something like
myArray = [CustomObject() for _ in range(10)]
I have seen these solutions: StackOverflow-Link but they don't seem to work with not built-in classes.
let myArray2 = (0...9).map{CustomObject()}
says "Type of expression is amiguous without more context"