Skip to content
George Kye edited this page Mar 7, 2016 · 14 revisions

Get the basic movie information for a specific movie id.

      MovieMDB.movie(apikey, movieID: 7984, language: "en"){
            apiReturn in
            let movie = apiReturn.MBDBReturn as! MovieDetailedMDB
            print(movie.title)
            print(movie.revenue)
            print(movie.genres[0].name)
            print(movie.production_companies[0].name)
            
        }

Get the alternative titles for a specific movie id.

MovieMDB.alternativeTitles(apikey, movieID: 12, country: nil){
            apiReturn in
            let altTitles = apiReturn.MBDBReturn as! Alternative_TitlesMDB
            print(apiReturn.json)
            print(altTitles.titles[0])
            print(altTitles.id)
        }

Get the cast and crew information for a specific movie id.

 MovieMDB.credits(apikey, movieID: 871){
            apiReturn in
            let credits = apiReturn.MBDBReturn as! CastCrewMDB
            for i in credits.cast {
                print(i.cast_id)
            }
            for i1 in credits.crew {
                print(i1.job)
            }
        }

Get the images (posters and backdrops) for a specific movie id.

 MovieMDB.images(apikey, movieID: 871, language: "en"){
            imgs in
            let images = imgs.MBDBReturn as! ImagesMDB
            print(images.posters[0].file_path)
            //Backdrop & stills might return `nil`
           // print(images.stills[0].file_path)
            //print(images.backdrops[0].file_path)
        }

Get the plot keywords for a specific movie id.

        MovieMDB.keywords(apikey, movieID: 1721){
            apiReturn in
            let keywords = apiReturn.MBDBReturn as! [KeywordsMDB]
            for keyword in keywords{
                print(keyword.id)
                print(keyword.name)
            }
        }

Get the videos (trailers, teasers, clips, etc...) for a specific movie id.

      MovieMDB.videos(apikey, movieID: 607, language: "en"){
            apiReturn in
            let videos = apiReturn.MBDBReturn as! [VideosMDB]
            for i in videos {
                print(i.site)
                print(i.key)
                print(i.name)
            }
        }

Get the similar movies for a specific movie id.

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

Get the latest movie id.

   MovieMDB.latest(apikey){
            latestMovies in
            let movie = latestMovies.MBDBReturn as! MovieDetailedMDB
            print(movie.title)
            print(movie.original_title)
            print(movie.release_date)
            print(movie.overview)
            print(movie.budget)
        }

Get the list of movies playing that have been, or are being released this week. This list refreshes every day.

        MovieMDB.nowplaying(apikey, language: "en", page: 1){
            nowPlaying in
            let movie = nowPlaying.MBDBReturn as! [MovieMDB]
            print(movie[0].title)
            print(movie[0].original_title)
            print(movie[0].release_date)
            print(movie[0].overview)
        }

Get the list of popular movies on The Movie Database. This list refreshes every day.

   MovieMDB.popular(apikey, language: "en", page: 1){
            popularMovies in
            let movie = popularMovies.MBDBReturn as! [MovieMDB]
            print(movie[0].title)
            print(movie[0].original_title)
            print(movie[0].release_date)
            print(movie[0].overview)
        }

Get the list of top rated movies. By default, this list will only include movies that have 50 or more votes. This list refreshes every day.

 MovieMDB.toprated(apikey, language: "en"){
            topRatedMovies in
            let movie = topRatedMovies.MBDBReturn as! [MovieMDB]
            print(movie[0].title)
            print(movie[0].original_title)
            print(movie[0].release_date)
            print(movie[0].overview)
        }

Get the list of upcoming movies by release date. This list refreshes every day.

 MovieMDB.upcoming(apikey, language: "en"){
            upcomingMovies in
            let movie = upcomingMovies.MBDBReturn as! [MovieMDB]
            print(movie[0].title)
            print(movie[0].original_title)
            print(movie[0].release_date)
            print(movie[0].overview)
        }
        
Clone this wiki locally