I tried to ask this question previously but didn't clearly express my question, so I'll try again here. I also noticed a very similar sounding question, but it is asking for something entirely different.
I have the following code:
class Base {
func launch(code1: Int, code2: Int) { ... }
}
class A: Base {}
class B: Base {}
class C: Base {}
let classes = [A.self, B.self, A.self, B.self, C.self]
for cls in classes {
let obj = ???
}
I would like to instantiate an object of type cls inside the loop and do something with it. I might have duplicates inside the array, as shown. What do I put in place of the ??? to be able to instantiate the proper objects?