Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic class 'SyncObject' requires that 'String' inherit from 'RealmSwiftObject' #266

Open
mibrahim025 opened this issue Oct 2, 2022 · 1 comment

Comments

@mibrahim025
Copy link

mibrahim025 commented Oct 2, 2022

Hi all, 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?

@andresitsu
Copy link

String is not an object. You only put realm objects as uListElementType.

Actually you don't need to do anything regarding List of supported primitive types ( Int, String etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants