I need some help to understand TheMovieDatabaseSwiftWrapper usage


(Twix) #1

Hi, I'm beginner at a very low level at the moment, and I'm stuck since long time on this situation.

I'm trying to use TheMovieDatabaseSwiftWrapper

    MovieMDB.similar(apikey, movieID: 334, page: 1, language: "en"){
  data, relatedMovies in
  if let movie = relatedMovies{
    print(movie[0].title)
    print(movie[0].original_title)
    print(movie[0].release_date)
    print(movie[0].overview)
  }
}

I wonder if anyone can explain little bit on how should I do to be able to use as example print(movie[0].title)
outside the if let movie = relatedMovies.

I want to use it on CollectionViewCell, what is the best solution?


#2

It sounds like you are trying to unwrap an optional to use later in the function. Have you tried “guard let”?