I have an array of books aka struct Book in the Top100Model below. I also have an array of books aka struct Data as well in the ISBNModel below. Both arrays have the same number of books and have a common property isbn13 which is a string holding a number. Id like to create a third array or merge the arrays so that it contains all the properties from Book in the Top100Model but add another two properties to the Top100Model or third which copies the ‘subjects’ and ‘synopsis’ properties from the ISBNModel to this array based on the matching isbn13 values.
Top100Model below
struct Top100Model: Decodable {
let results: Result
private enum CodingKeys: String, CodingKey {
case results
}
}
struct Result: Decodable {
let listsb: [ListB]
private enum CodingKeys: String, CodingKey {
case listsb = "lists"
}
}
struct ListB: Codable {
let books: [Book]
}
struct Book: Codable, Identifiable {
let id = UUID()
let author: String
let description: String
let isbn13: String
let rank: Int
let title: String
}
ISBNModel Below
struct ISBNModel: Codable {
let total: Int
let requested: Int
let data: [Data]
}
struct Data: Codable {
let synopsis: String
let subjects: [String]
let isbn13: String
2