Start a new topic

Trouble with Property Mapping: Getting Array of Custom Objects.

I have an array of objects I'm trying to get out of one of my collections. I've followed along using their docs and also some Googling and I believe I'm close to the solution, however not close enough. Here's what I have:


class Clothing: Entity {

    var categories: [Category]!
    var gender: String!

    override class func collectionName() -> String {
    //return the name of the backend collection corresponding to this entity
        return "categories"

    override func propertyMapping(_ map: Map) {

        categories <- map["clothing"]
        gender <- map["gender"]


class Category: NSObject, Mappable{

    var title: String?
    var image: String?

    convenience required init?(map: Map) {

    func mapping(map: Map) {
        title <- map["category"]
        image <- map["image"]

I'm able to get the right gender, but the array of categories doesn't seem to get mapped to the Category object. Any thoughts? 

1 Comment


Please check

You should use "List<Category>()" instead "[Category]!". As per Kinvey documentation, List<T> types must be unmutable using the keyword let instead of the usual declaration dynamic var.

Also, each property in your entity should be mapped using the following scheme:
<member variable> <- ("<backend property>", map["<backend property>"])

Example: title <- ("title", map["title"])



Login or Signup to post a comment