I need some help to understand TheMovieDatabaseSwiftWrapper usage

off-topic

#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”?


#3

I have another question about the same framework.

If I have a String that represents a movie name, how wold it be possible to check if the movie name is actually a movie and not a tv show or anything else?


(Jeremy David Giesbrecht) #4

That second question has little to do with Swift itself, so this isn’t really the place.

You can ask the framework authors directly. But I would peruse their documentation first to see if the answer is already there.