Movie Night

This app helps two people decide on a movie to watch. Each person chooses their preferences for genres, actors, and decades. Once both people have made their choices, the app will display movies that match both of their preferences.

Uses tMDB API (https://www.themoviedb.org/) to fetch movie data. Created for the Treehouse iOS Techdegree Unit 7.

Technical Background
REST API

This app relies on the tMDB API to fetch data for movies, genres, and actors/actresses. Codable models are used to encode/decode JSON from the API endpoints. URLSession is used to fetch the data asyncronously. Endpoints for movies and actresses/actors have thousands of results, so they need to be paged. UITableViewDataSourcePrefetching is great for this sort of thing since you can get advanced warning when table cells that haven't been loaded yet are about to come into view. When prefetching cells that haven't been loaded yet, results for the next page can be fetched from the REST API. The UITableViews for genres and decades didn't need this because there were not that many to choose from.

The thumbnails for the table cells were downloaded using Kingfisher which does a great job of managing image downloads and caching them. tMDB API provides many options for image sizes to download, which is great because you can get quick download times and small memory usage by downloading their thumbnail size images for table cell images.

 

Movie Night – People
Movie Night – Movies

 

Finding a Match

This app takes a simple approach to finding movies that could be a match for the two people. Prefrences are stored as sets for each user. Once both users have finished choosing their preferences, set intersection is used to get the choices common to both users. If there's nothing in common, then set union is used to get a combination of both of their preferences. For example, if user A chooses the genres Action, Adventure, Animation, Comedy, and Crime, then user B chooses Comedy, Crime, Documentary, Drama, and Family, then the app would fetch results for movies that belong to the genres Comedy and Crime.


Movie Night – Ready