Latest 0.0.1
License MIT
Platforms ios 10.0, osx 10.12, watchos 3.0, tvos 10.0, requires ARC
Dependencies SwiftyJSON

codebeat badge
Travis CI

This framework is still under development. DO NOT use it… just yet 😂.
And if you are willing to help, feel free to creat pull requests.

The Movie Database API wrapper in Swift.

I’m just a very beginner to the Swift world. And I decide to take this project as my first step. So any issue and pull request are welcomed :-)

Project progress

v3 current progress:

Section Build Test To-dos
Shared methods ☑️ ☑️
Account       ☑️     ☑️          
Authentication ☑️ ☑️
Certifications ☑️ 👊
Changes ☑️
Collections ☑️
Companies ☑️
Configuration ☑️
Credits ☑️ What are credits?
I wish I have take English class more seriously😂.
Discover ☑️
Find ☑️
Genres ☑️
Guest Sessions ☑️
Jobs ☑️
Keywords ☑️
Lists ☑️
Movies ☑️ Cresits model.
Append to response support.
Networks ☑️
People ☑️ Append to response support.
Reviews ☑️ Append to response support.
Search ☑️ Multi search.
Timezones ☑️
TV ☑️ Append to response support.
Changes model.
TV Seasons ☑️ Append to response support.
Changes model.
TV Episodes ☑️ Append to response support.
Changes model.
Cleaning job   ☑️          

v4 current progress:

Will begin soon.



With CocoaPods:


target 'TMDBKitDemo' do
    platform :osx, '10.12'
    pod 'TMDBKit'

Or simply drag all .swift files in Common folder to your project (please note that TMDBKit needs SwiftyJSON as dependency).

Meet TMDBManager

All you need with TMDBKit is wrapped in the TMDBManager singleton instance, like this:

import TMDBKit

let manager = TMDBManager.shared

Setup the TMDBManager

In your AppDelegate’s applicationDidFinishLaunching method:

let manager = TMDBManager.shared
manager.setupClient(withApiKey: "Your-API-key", persistencePrefix: "com.yourTeamName.yourAppName")

Get user authentication

First you need to fetch a request token by:

let manager = TMDBManager.shared
manager.createRequestToken() { result in
    switch result {
    case .success:
        // Forward your user to the authentication page. For macOS:
        let redirectURL = "yourAppURLScheme://auth_done" redirectURL)!)
    case .fail(let error):

And after the user authorizes the request token, fetch a session ID:

let manager = TMDBManager.shared
manager.authentication.createSession() { result in
    switch result {
    case .success:
        print(Session ID Fetched: (TMDBManager.shared.sessionId!))
    case .fail(let error):

The session ID will be persisted in the keychain.

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):

    // Otherwise, you will get an optional error
    case .fail(let 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:


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

Latest podspec

    "name": "TMDBKit",
    "version": "0.0.1",
    "summary": "The Movie Database API wrapper in Swift.",
    "description": "The Movie Database API wrapper in Swift.nSee the Github page for usage and other info.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Siyuan Cao": "[email protected]"
    "platforms": {
        "ios": "10.0",
        "osx": "10.12",
        "watchos": "3.0",
        "tvos": "10.0"
    "source": {
        "git": "",
        "tag": "0.0.1"
    "source_files": [
    "requires_arc": true,
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "4.0"
    "dependencies": {
        "SwiftyJSON": []
    "pushed_with_swift_version": "4.0"

Pin It on Pinterest

Share This