I have a class called Bullet
and I want to make a mutable array with this class type. Basically the desired outcome I want is, when a user touches the screen a new bullet is spawned. I know in Java you can use an ArrayList
to achieve this by adding a new instance to the array list each time.
I'm not sure syntactically how I could achieve in Swift or if it is even possible.
This is the code I have for declaring and instance of the Bullet
class but how do I make it so that it is a mutable array...
var bullet: Bullet = Bullet()
Thank you!