I created a struct and want to convert to [[String]]
var ucetPlatby = [struct_ucetPlatby]()
struct struct_ucetPlatby {
let id: Int
let trasaid: Int
let cena: Decimal
}
override func viewDidLoad() {
super.viewDidLoad()
ucetPlatby.append(.init(id: 1, trasaid: 1, cena: 33))
ucetPlatby.append(.init(id: 3, trasaid: 1, cena: 44))
ucetPlatby.append(.init(id: 4, trasaid: 1, cena: 55))
print(ucetPlatby)
}
…which results in:
[UD.ViewController.struct_ucetPlatby(id: 1, trasaid: 1, cena: 33), UD.ViewController.struct_ucetPlatby(id: 3, trasaid: 1, cena: 44), UD.ViewController.struct_ucetPlatby(id: 4, trasaid: 1, cena: 55)]
But how can I convert the struct object to something like [String]
[["1", "1", "33"], [["3", "1", "44"], [["4", "1", "55"]]