Jonas m
Jonas m

Reputation: 2734

SwiftyJson adding to end of object/Array

I have a SwiftyJSON object representing questions and answers, fetched as JSON from a webserver.

What i would like to achieve, is to add questions to the end of the SwiftyJSON object, taken that the user answers the question wrongly.

I've tried the following

JsonArray[ JsonArray.count+1 ] = JsonArray[CurrentIndex]

But nothing happens at all.

Any ideas?

Thanks in advance

Upvotes: 1

Views: 550

Answers (1)

alexdd55
alexdd55

Reputation: 1117

It is surprisingly simple:

let data = JSON(currentdata.arrayObject! + newdata.arrayObject!)

Upvotes: 2

Related Questions