ios – Generic class ‘SyncObject’ requires that ‘String’ inherit from ‘RealmSwiftObject’

0
178


I am using IceCream Library and want to achieve the following functionality.

In app delegate, I have written

syncEngine = SyncEngine(objects: [
            SyncObject(type: Recipient.self, uListElementType: String.self),
            SyncObject(type: SMSSchedule.self, uListElementType: Recipient.self),
            SyncObject(type: Template.self),
            SyncObject(type: ContactsGroup.self, uListElementType: Recipient.self)
        ])

where Recipient class is…

@objc class Recipient: Object {
    
    @objc dynamic var rec_id = ""
    @objc dynamic var firstName = ""
    @objc dynamic var lastName = ""
    var phoneNumbers = List<String>()
    @objc dynamic var email = ""
    @objc dynamic var colorTag = "#FFFFFFFF"
    @objc dynamic var isDeleted = false  // IceCream requirement
    
    override static func primaryKey() -> String? {
        return "rec_id"
    }

// initialization code

}

Look at the phoneNumbers property. It is a list of string objects. However the SyncObject doesn’t accept String as uListElementType. How can I solve this issue? Please help urgently as I am implementing a feature in my app and it’s almost finished. Just this issue is a hurdle now.