Completion hanlders

Almost all TMDBKit methods needs a completion parameter. The handler will pass in a enum by which you can check if the request has been fullfied. And to those methods that returns data, the enum will carry a model object. It works like this:

let manager = TMDBManager.shared
manager.account.getDetails() { result in
// Check if the request has been fullfied
switch result {
// If success, you will recive a model object
case .success(let accountInfo):
print(accountInfo)
// Otherwise, you will get an optional error
case .fail(let error):
print(error)
}
}

Need help?

All methods are equiped with full documentation comments. All you need to do is Option⌥ click the method name. Or switch to the Quick Help Inspector:

License

TMDBKit is available under the MIT license. See the LICENSE file for more info.