pableiros pableiros - 2 months ago 28x
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


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.