A simple and scalable iOS application to browse movie details using The Movie Database (TMDB) API. This project follows a Standard MVVM architecture approach with a generic network layer using URLSession/Alamofire.
- Fetch and display movie details
- Scalable API integration using Alamofire
- Standard MVVM Architecture and modular project structure
- Pagination support for movie lists (Pull to refresh & Infinite scrolling)
- Centralized API handling
- Optimized network calls with error handling
swift-api-integration/
│
├── TheMovie/
│ ├── AppDelegate.swift
│ ├── SceneDelegate.swift
│ ├── AppNavigationViewController.swift
│ ├── CommonStuff/ # Network layer (API.swift), Endpoints, and Utilities
│ └── ViewControllers/ # UI Components
│ ├── MovieList/ # Movie List Screen (MVVM)
│ │ ├── MovieListViewController.swift & .xib
│ │ ├── DataModule/ # ViewModels & Models
│ │ ├── DataSource/ # UITableViewDataSource implementations
│ │ └── MovieCell/ # Custom Table View Cells
│ └── MovieDetails/ # Movie Details Screen
This project uses the TMDB API.
You must add your own API key before running the project. Steps:
- Create an account on TMDB
- Generate your API key
- Open the file:
TheMovie/CommonStuff/API.swift - Add your API key:
struct Config {
static let BaseUrl = "https://api.themoviedb.org/3"
static let APIKey = "YOUR_API_KEY_HERE"
}- Clone the repository
git clone https://github.com/Coderkube-App/swift-api-integration.git- Install Pods
Ensure CocoaPods is installed (
sudo gem install cocoapods).
pod install-
Open the project Open the generated
TheMovie.xcworkspace. -
Run the app Select your target simulator/device and run the scheme (Cmd+R).
- Swift
- UIKit
- Alamofire (HTTP client)
- CocoaPods
- Do not commit your API key to public repositories
- If API calls fail, check:
- Internet connection
- API key validity
- Rate limits
- Separation of concerns (Standard MVVM: ViewControllers, ViewModels, Models)
- Reusable network layer
- Data source decoupling
- Search movies
- Favorites or Watchlist
- Movie trailers
- Dark mode support
- Feel free to fork and improve this project
- Pull requests are welcome