pableiros pableiros - 1 year ago 344
Swift Question

RealmSwift List requires that String inherit from Object

I'm trying to have a list of Strings on

like this:

import Foundation
import RealmSwift

// V1
class foo: Object {
let strings = List<String>()

But I get this error:

'List' requires that 'String' inherit from 'Object'

Is anyway to create a list of Strings without creating an entire class with one String property in

Answer Source

Arrays of primitives are not yet supported by Realm Swift. You can subscribe to GitHub issue 1120 to be notified when we add support. Until then you'll need to wrap the string in a class that derives from RealmSwift.Object.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download