I want to add new data to Mappable
class
. Here is my class
:
import Foundation
import ObjectMapper
struct AllcategoriesModel : Mappable {
var allcategories : [Allcategories]?
init?(map: Map) {
}
mutating func mapping(map: Map) {
allcategories <- map["allcategories"]
}
}
The way I am adding new data to class
:
if json["allcategories"].exists() {
categoriesDataSource = Mapper<AllcategoriesModel>().map(JSON: json.object as! [String : Any])
//Other Stuff...
}
Now, I want to append data manually, any help will be appreciated.