Код: Выделить всё
struct RGBA: Codable {
var r: UInt8
var g: UInt8
var b: UInt8
var a: UInt8
}
< /code>
Я хочу сохранить большое количество этих структур (> 1_000_000) < /p>
Декод < /p>
guard let history = try? JSONDecoder().decode(HistoryRGBA.self, from: data) else { return }
< /code>
Encode < /p>
guard let jsonData = try? encoder.encode(dataForSave) else { return false }
Подробнее здесь: https://stackoverflow.com/questions/630 ... -ios-swift