How to store generic structs with PAT in array?

I have a simple protocol for any kind of diffable models:

protocol PSDiffableModelProtocol: Hashable {
  var identifier: UUID { get }
}

extension PSDiffableModelProtocol {
  func hash(into hasher: inout Hasher) { hasher.combine(identifier) }

  static func == (lhs: Self, rhs: Self) -> Bool { lhs.identifier == rhs.identifier }
}

Well and actually the structures implementing this protocol:

struct PSModel1: PSDiffableModelProtocol, Decodable {
  let identifier = UUID()
  let title: String
  let subtitle: String
  let additionalSubtitle: String
  let imageUrl: URL
  let footnote: String?
}

struct PSModel2: PSDiffableModelProtocol, Decodable { /* ... */ }

// ....

Each model must be stored in another diffable model:

struct PSSection<Model: PSDiffableModelProtocol>: PSDiffableModelProtocol {
  let identifier = UUID()
  let title: String?
  let subtitle: String?
  let models: [Model]
}

And then there is a simple question, but how do I store my sections in a single place? Like that:

var sections: [PSSection] = [
   PSSection(..., models: [PSModel1(...), PSModel1(...), ]),
   PSSection(..., models: [PSModel2(...), PSModel2(...), ]),
   // ...
]

I just want to get something like this(with generics):

 _collections = [
            VideoCollection(title: "The New iPad Pro The New iPad Pro The New iPad Pro The New iPad Pro The New iPad Pro The New iPad Pro",
                            videos: [Video(title: "Bringing Your Apps to the New iPad Pro", category: "Tech Talks"),
                                     Video(title: "Designing for iPad Pro and Apple Pencil", category: "Tech Talks")]),
            
            VideoCollection(title: "iPhone and Apple Watch",
                            videos: [Video(title: "Building Apps for iPhone XS, iPhone XS Max, and iPhone XR",
                                           category: "Tech Talks"),
                                     Video(title: "Designing for Apple Watch Series 4",
                                           category: "Tech Talks"),
                                     Video(title: "Developing Complications for Apple Watch Series 4",
                                           category: "Tech Talks"),
                                     Video(title: "What's New in Core NFC",
                                           category: "Tech Talks")]),
                        // ...
]
Terms of Service

Privacy Policy

Cookie Policy