Skip to content

MOHITKOURAV01/PopcornTime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PopcornTime 🍿

PopcornTime Logo

Swift SwiftUI iOS


PopcornTime is a premium, dark-themed iOS application designed for the modern cinephile. Built entirely with SwiftUI and SwiftData, it offers a seamless experience for browsing trending cinematic content, searching a global media database, and streaming trailers directly within a custom-engineered native playback environment.


App Demo :-

Watch the App Demo on Google Drive 📱


Table of Contents


Key Features

  • Live Discovery Hub: Real-time trending feeds for both Movies and TV Shows.
  • Smart Global Search: Optimized query engine with background task throttling.
  • Persistent Favorites: Full local lifecycle management via SwiftData (iOS 17+).
  • Secure Native Playback: Custom WKWebView implementation bypassing cross-origin restrictions for YouTube trailers.
  • Interactive Library: Offline download tracking and favorites management with swipe-to-delete support.

Full App Showcase

The following is a complete walkthrough of the PopcornTime interface and user journey.

1. Discovery & Arrival

   

  • Home Feed: The landing experience featuring a high-impact Hero Spotlight with a blurred glassmorphism backdrop. It orchestrates multiple horizontal scrolling carousels for Trending and Top Rated content categories.
  • Upcoming Feed: A focused vertical list pulled from TMDB's future cinematic release dates, providing a "coming soon" overview for movie enthusiasts.

2. Precision Search Engine

   

  • Universal Search: Supports both Movies and TV Shows via a simple toggle button in the navigation bar.
  • Dynamic Grid: Utilizes an optimized LazyVGrid layout that fetches image data asynchronously. The search is throttled to prevent API over-fetching while typing.

3. Native Media Playback

   

  • Cinema Mode: When a title is clicked, the app automatically finds the official trailer via YouTube Data API v3.
  • Security Bypass: Implements custom header handling to bypass Error 153 and Error 152 restrictions, embedding YouTube trailers natively within the app interface for a seamless watching experience.

4. Personal Library & Favorites

   

  • Collection View: A dedicated dashboard for all favorited and saved content.
  • Local Persistence: Powered by SwiftData, ensuring that your saved movies and shows are available instantly even without an internet connection. Includes a smooth list-edit interface with swipe-to-delete native behavior.

Technical Showcase

The Native Playback Bypass

Standard iOS web-views often crash when embedding YouTube iFrames due to Referer header validation. PopcornTime implements a secure HTML-injection proxy:

// We bypass strict origin headers by loading a localized iframe protocol
let html = """
<iframe src="https://www.youtube.com/embed/\(key)" 
        referrerpolicy="strict-origin-when-cross-origin" 
        allowfullscreen></iframe>
"""
webView.loadHTMLString(html, baseURL: URL(string: "http://localhost/"))

SwiftData Persistence

Leveraging iOS 17's SwiftData, the app maintains a lightweight local database for favorites and downloads, ensuring your library is always accessible offline.


Tech Stack

  • UI Framework: SwiftUI (Declarative UI)
  • Data Layer: SwiftData (Reactive persistence)
  • Networking: Native URLSession with Async/Await
  • Media: Webkit/WKWebView for secure trailer delivery
  • Architectural Pattern: MVVM (Model-View-ViewModel)

Project Structure

PopcornTime/
├── PopcornTime/
│   ├── Assets.xcassets/    # Cinematic assets and App Icon
│   ├── ViewModels/         # Logic-heavy Search & Video states
│   ├── Views/              # Modular SwiftUI Components
│   ├── Models/             # SwiftData Titles & TMDB Schema
│   └── APIConfig.swift     # Secure Key Management
├── Screenshots/            # Documentation Visuals
└── PopcornTime.xcodeproj   # Project configuration

Getting Started

1. Requirements

  • Xcode 15.0+
  • iOS 17.0+ (Simulator or Physical Device)
  • TMDB API Key (Get one here)
  • YouTube Data API v3 Key (Get one here)

2. Configuration

The app uses a secure APIConfig.json file.

  1. Copy the example: cp PopcornTime/APIConfig.example.json PopcornTime/APIConfig.json
  2. Open APIConfig.json and insert your keys.

3. Build & Run

Push Cmd + R in Xcode to launch the cinematic experience.


Contributing

Contributions are welcome! If you have a feature request or a bug fix:

  1. Fork the repo.
  2. Create your branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes.
  4. Push to the branch.
  5. Open a Pull Request.

Made by MOHIT KOURAV

About

PopcornTime is a premium, dark-themed iOS app built with SwiftUI and SwiftData. It offers seamless movie discovery, real-time search, and native trailer streaming for the modern cinephile.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages