TheMovieDatabase
public class TheMovieDatabase
The main interface for fetching data from themoviedb.org
-
URL factory for themoviedb.org REST services
Declaration
Swift
private let urls: TheMovieDatabaseURLFactory -
A cache for movie poster images
Declaration
Swift
private let cache: NSCache<NSString, AnyObject>? -
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
searchQueryA search query
completionA 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
paththe filepath where the image can be found
sizeThe requested size of the poster to be returned
qualityThe image quality of the poster that is returned
completionA closure to handle the movie poster
View on GitHub
TheMovieDatabase Class Reference