Reputation: 764
I wanna to save a list of list in realm data base. My model is
import Foundation
import RealmSwift
class CompanyDetailRSM : Object{
// properties and constructor
}
I wanna to create a list of list of above model type in below model
import Foundation
import RealmSwift
class CompanyDetailRSMList: Object {
// I wanna to declare a list in realm like
// let list = [[CompanyDetailRSM]]()
var Two_D_list = List<<CompanyDetailRSM>>()// here I gets error
}
I am new to realm, so please help me to declare a 2 dimensional list in realm. Help will be appreciated
Upvotes: 0
Views: 1634
Reputation: 1787
If you want a list of lists, you will have to declare an Object
subclass that contains a single list property (representing the inner list), and then create a list of said Object
wrappers (representing the outer list). Realm does not directly support multi-dimensional array types.
Upvotes: 2