TheMovieDatabase
public class TheMovieDatabase
The main interface for fetching data from themoviedb.org
-
Designated initializer
Declaration
Swift
public init(with cache: NSCache<NSString, AnyObject>? = nil)
-
Searches for movies on themoviedb.org using a given search query
Declaration
Swift
public func searchFor(movieNamed searchQuery: String, completion: @escaping MovieSearchResultsCompletionHandler)
Parameters
searchQuery
A search query
completion
A completion handler to handle the HTTP response
-
Retrieves a movie poster from the cache. If it does not exist in the cache, it will download it from the themoviedb.org
Declaration
Swift
func getImage(atPath path: String, size: CGSize = CGSize(width: 600, height: 900), quality: ImageQuality = .best, completion: @escaping ImageDownloadCompletionHandler)
Parameters
path
the filepath where the image can be found
size
The requested size of the poster to be returned
quality
The image quality of the poster that is returned
completion
A closure to handle the movie poster