Append multiple object at once

Hello everyone,

I am wondering about how can I append multiple objects class to the array in one line?

For example:

 

class someClass {

var name: String

var ID: Int

init (name: String, ID: Int){

self.name = name

self.ID = ID }

}

So, I want do something like that:

var array = [someClass]()

array.append(someClass(name:”IOS”, ID:5), someClass(name:”Android”, ID: 4))

 

can you help me please?

Powered by WPeMatico

About

You may also like...

Comments are closed.