https://github.com/igorcamilo/tmdb-swift
Modern Swift client for The Movie Database (TMDB) API. Fetch movies, TV shows, and configuration data with pure Swift and multi-platform support.
https://github.com/igorcamilo/tmdb-swift
api-client async-await codeql concurrency ios macos movies swift swift-package tmdb tv-shows tvos visionos watchos
Last synced: 4 months ago
JSON representation
Modern Swift client for The Movie Database (TMDB) API. Fetch movies, TV shows, and configuration data with pure Swift and multi-platform support.
- Host: GitHub
- URL: https://github.com/igorcamilo/tmdb-swift
- Owner: igorcamilo
- License: mit
- Created: 2025-07-16T17:58:37.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-13T19:53:56.000Z (10 months ago)
- Last Synced: 2026-02-14T16:40:24.537Z (4 months ago)
- Topics: api-client, async-await, codeql, concurrency, ios, macos, movies, swift, swift-package, tmdb, tv-shows, tvos, visionos, watchos
- Language: Swift
- Homepage:
- Size: 194 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TMDB
[](https://swiftpackageindex.com/igorcamilo/tmdb-swift)
[](https://swiftpackageindex.com/igorcamilo/tmdb-swift)
[](https://github.com/igorcamilo/tmdb-swift/actions/workflows/unit-tests.yml)
[](https://codecov.io/gh/igorcamilo/tmdb-swift)
Swift client for [The Movie Database (TMDB) API](https://www.themoviedb.org/documentation/api), supporting movies, TV shows, and configuration endpoints. Built for modern Swift and concurrency.
---
## Features
- Fetch movies and TV shows by popularity, rating, trending, and more
- Retrieve similar movies/TV shows
- Access TMDB configuration (image base URLs, sizes, etc.)
- Codable, Sendable, and concurrency-friendly API
- Supports iOS, macOS, tvOS, and watchOS
- 100% Swift, no dependencies
- Unit tested
## Requirements
- Swift 5.9+ on Apple platforms
- Swift 6.0+ on Linux
- iOS 13.0+, macOS 10.15+, tvOS 13.0+, watchOS 6.0+
## Installation
Add the package to your `Package.swift`:
```swift
.package(url: "https://github.com/igorcamilo/tmdb-swift.git", from: "0.1.0")
```
Or use Xcode's Swift Package Manager integration.
## Usage
```swift
import TMDB
let client = Client(accessToken: "YOUR_TMDB_ACCESS_TOKEN")
// Fetch popular movies
let page = try await client.movies(list: .popular)
for movie in page.results {
print(movie.title)
}
// Fetch trending TV shows
let tvPage = try await client.tvShows(list: .trending(.day))
for show in tvPage.results {
print(show.name)
}
// Fetch API configuration
let config = try await client.configuration()
print(config.images.baseURL)
```
## API Overview
### Movies
- `.nowPlaying` — In theatres
- `.popular` — By popularity
- `.topRated` — By rating
- `.upcoming` — Coming soon
- `.similar(Movie.ID)` — Similar movies
- `.trending(TrendingTimeWindow)` — Trending
### TV Shows
- `.airingToday` — Airing today
- `.onTheAir` — Next 7 days
- `.popular` — By popularity
- `.topRated` — By rating
- `.similar(TVShow.ID)` — Similar shows
- `.trending(TrendingTimeWindow)` — Trending
### Configuration
- `client.configuration()` — Get image base URLs, sizes, etc.
## Testing
Run all tests with:
```sh
swift test
```
## Code Style
- 2-space indentation and Unix line endings enforced via `.editorconfig`.
- Linting is automated in CI with Swift Format.
## License
MIT License. See [LICENSE](LICENSE).
## Acknowledgments
- [TMDB](https://www.themoviedb.org/) for the movie/TV data API
---
> This project is not affiliated with TMDB. You need your own TMDB API access token.