add "Load More" to tableview NSObject json parse

266 views Asked by At

hi i have blog application parser from json object its work well , i want add ''load more' for table view but I got this error in this line

appDataArray.addObjectsFromArray(allObjectArray.subarrayWithRange(NSMakeRange(currentPage, 20)))

the error

https://i.stack.imgur.com/jQHwj.png

this object code

var title: String
var image: String
var web: String
var catname: String
var datepost: String




init(title: String, image: String, web: String, catname: String, datepost: String) {

    self.title = title
    self.image = image
    self.web = web
    self.catname = catname
    self.datepost = datepost

    super.init()

}


 var Description: String {

    return "[\(self.title), \(self.image), \(self.web), \(self.catname), \(self.datepost)]"
}

so how fix that

1

There are 1 answers

2
Eric Aya On BEST ANSWER

The method addObjectsFromArray is available for NSMutableArrays, but given your screenshot I guess your appDataArray is instead a Swift array (of tuples).

You should either make your Swift array an NSMutableArray, or add objects to your Swift array without using addObjectsFromArray, it's your choice.

I would suggest to go with the Swift array since it will allow you to benefit from the Swift types.