how convert value of type 'MoviesDataSource.Section.Item' to closure result type 'Movie'

I have have 2 object one Movie and Section I have this error message "Cannot convert value of type ‘MoviesDataSource.Section.Item’ to closure result type ‘Movie’" can someone help me to resolve this issue ?

struct Section {
    struct Item {
        let identifier: Int
        let title: String
        let thumbnailURL: URL
    }
    let items: [Movie]
}

/// The sections that comprise the data source.
let sections: [Section]

/// Describes the ways that items can be distributed across sections.
enum SectionStyle {
    
    case single
    
  
    case byAGenres(maximumItemsPerAlbum: Int?, maximumNumberOfAlbums: Int?)
}

init(movies: [Movie], sectionStyle: SectionStyle) {
    switch sectionStyle {
    case .single:
            self.sections = [Section(items: movies.map { Section.Item(identifier: $0.id, title: $0.title, thumbnailURL: $0.posterURL)})]< "Cannot convert value of type 'MoviesDataSource.Section.Item' to closure result type 'Movie'"

>Solution :

Typo.

Replace

let items: [Movie]

with

let items: [Item]

Leave a Reply