A Swift Package for The Movie Database (TMDb) https://www.themoviedb.org
- Swift 5.9+
- OS
- macOS 13+
- iOS 16+
- watchOS 9+
- tvOS 16+
- visionOS 1+
- Windows
- Linux
Add the TMDb package as a dependency to your Package.swift
file, and add it
as a dependency to your target.
// swift-tools-version:5.9
import PackageDescription
let package = Package(
name: "MyProject",
dependencies: [
.package(url: "https://github.com/adamayoung/TMDb.git", from: "13.0.0")
],
targets: [
.target(name: "MyProject", dependencies: ["TMDb"])
]
)
Add the TMDb package to your Project's Package dependencies.
Create an API key from The Movie Database web site https://www.themoviedb.org/documentation/api.
let tmdbClient = TMDbClient(apiKey: "<your-tmdb-api-key>")
let moviesToDiscover = try await tmdbClient.discover.movies().results
let fightClub = try await tmdbClient.movies.details(forMovie: 550)
Documentation and examples of usage can be found at https://adamayoung.github.io/TMDb/documentation/tmdb/
Install homebrew and the follow formulae
brew install swiftlint swiftformat markdownlint xcbeautify
Ensure all new code is covered by unit tests. If any new methods are added to services that make calls to TMDb API endpoints, ensure there are integration tests covering these.
Coding style is enforced by swiftlint
and swiftformat
.
Use the following command to lint the codebase:
make lint
To format the codebase use:
make format
Ensure all public
classes, structs, properties and methods are commented
The DocC documentation can be built and hosted locally by
make preview-docs
See DocC | Apple Developer Documentation for more details.
Before submitting a PR, ensure all CI checks will pass:
make ci
CI checks are made up of the follow tasks:
make lint
make lint-markddown
make test
make test-ios
make test-watchos
make test-tvos
make test-visionos
make test-linux
make integration-test
make build-release
make build-docs
In order to run integration tests the following environment variables need to be set.
TMDB_API_KEY
- Your TMDb API keyTMDB_USERNAME
- Your TMDb usernameTMDB_PASSWORD
- Your TMDB password
If these environment variables aren't set then integration tests are skipped
when not using make
.
Running unit tests on Linux requires Docker to be running.
This library is licensed under the Apache License 2.0. See LICENSE for details.