I have sample array of [[string]] like this [["A", "B", "C"], ["A"], ["B", "C"], ["C"], ["B"], ["B", "C", "A"]]
I store it to core data like this :
insertHeroes.setValue(roless, forKey: "roles")
which roless is array result from API (after append loop) with var roless = [[String]]()
core data is stored in list var coreHeroList: [NSManagedObject] = []
but when I try to get from core data and store it (after removeall) like this :
if (coreHeroList.count > 0) {
for hero in coreHeroList {
roless.append(hero.value(forKey: "roles") as? [[String]] ?? [[""]])
}
}
it give red error : Cannot convert value of type '[[String]]' to expected argument type '[String]'
My transformable is like this :

I set core data to manual and already set NSManagedObject SubClass
How to get [[string]] from core data? Does my insert to core data wrong?
I think the
[[String]]is being stored in CoreData correctly. The problem is that you are trying to append it directly toroless: you can append things of type[String], but you can't append things of type[[String]]. You can, however, merge them:But I agree with @JoakimDanielson's comment: it might be wise to create a
Roleentity and model a to-many relationship rather than handle transformables.