How to append new data to an existing JSON array(swiftyJSON)

后端 未结 6 1036
梦谈多话
梦谈多话 2021-01-08 00:55

I have an array of SwiftyJson data that I have declared and filled it with data .The code I\'m using to fill the hoge array is this : self.hoge = JSON(data: data!)

6条回答
  •  萌比男神i
    2021-01-08 01:23

    self.hoge should be a Swift Array (which is mutable if declared as var) or casted to a NSMutableArray. If it is of Array type use append. If casted to an NSMutableArray use self.hoge.addObject(yourObject).

提交回复
热议问题