Skip to content

RealmSwiftObject empty  #310

@oenama

Description

@oenama

Realm object is empty

here's the model declaration:

Category.swift

import EVReflection
import RealmSwift

 @objcMembers

class  Category :  Object, EVReflectable  {
 
    override class func primaryKey() -> String? {
        return "id"
    }
       dynamic var id : NSNumber = 0
       dynamic var name : String?
       dynamic var sub_Category : SubCategory?  // the empty object 

 }

SubCategory.swift


import EVReflection
import RealmSwift

 @objcMembers


class  SubCategory :  Object, EVReflectable  {
 
        dynamic var name : String?
        dynamic var type : String?

 }

API response - > JSON

{
id = 45 
name = "test category"
 sub_Category =     {
        name = "test";
        type = "testType";
     }
 }

--> let result_ = Category(json: responseData as? String)

print(result_) -->

Products {
	id = 45;
       name = "test category"; 
      sub_Category = RealmSwiftObject {
	};    // -->  here's the empty object 
 }
 

any idea why this happens ?


EVReflection -> Version 5.10.1
Realm -> Version 3.16.1

**pods installed **
pod 'EVReflection'
pod 'EVReflection/Realm'


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions