0

I have my data model set up as such;

struct BrowseSection: Hashable, Codable {
    var id: String? = nil
    var index: Int
    var title: String
    var subtitle: String
}

struct BrowseItem: Codable, Hashable {
    var id: String? = nil
    var title: String
    var subtitle: String
    var image_URL: String
    var section: BrowseSection
}

The data comes in as an array of BrowseItem. I would like to map these objects into a dictionary of;

let myDict: [BrowseSection: [BrowseItem]]

with the BrowseSection data coming in from the 'section'

How would I go about this?

David Henry
  • 1,972
  • 20
  • 43

0 Answers0