Skip to content

Conversation

Copy link

Copilot AI commented Oct 8, 2025

Overview

This PR adds comprehensive theming support to the Dropped app, allowing users to choose between light mode, dark mode, or system preference (which follows the device's theme setting).

Changes

Core Implementation

Added a new AppTheme enum to the data model with three options:

  • System (default) - Follows device light/dark mode preference
  • Light - Forces light mode regardless of device setting
  • Dark - Forces dark mode regardless of device setting

The theme preference is persisted in the UserData model and automatically applied app-wide via a new ThemeManager class that observes theme changes and updates the root view's color scheme.

User Interface

Added a new "Appearance" section to the Settings view with an intuitive segmented picker:

  • Each theme option has a distinctive icon (sparkles for system, sun for light, moon for dark)
  • Theme changes apply immediately with real-time visual feedback
  • Preference persists across app launches
  • Settings is now accessible from the main navigation menu

Architecture

ThemeManager Class (DroppedApp.swift)

  • Observable object managing app-wide theme state
  • Loads user preference on initialization
  • Listens for theme changes via NotificationCenter
  • Automatically applies color scheme to entire app

UserData Model (Models/UserData.swift)

  • New theme: String field for persistence
  • Helper method appTheme() for type-safe access
  • Default value ensures backward compatibility

Settings UI (Views/SettingsView.swift)

  • New Appearance section with theme picker
  • ViewModel method to update and broadcast theme changes
  • Clean integration with existing settings structure

Testing

Unit Tests (DroppedTests/UserDataTests.swift)

  • AppTheme enum functionality and color scheme mapping
  • UserData theme field persistence and serialization
  • Invalid theme handling (defaults to system)
  • Helper method behavior

UI Tests (DroppedUITests/ThemeUITests.swift)

  • Theme selection workflow in Settings
  • Preference persistence across navigation
  • UI state verification

Documentation

  • Updated docs/memory.md with architecture changes
  • Created docs/features/theming.md with comprehensive feature documentation including implementation details, user guide, and technical flow diagrams

Backward Compatibility

Existing users automatically default to system theme, maintaining their current experience while gaining the option to customize. No data migration required.

Technical Details

Theme changes propagate through the app via:

  1. User selection in Settings → SettingsViewModel updates UserData
  2. UserDataManager persists the change
  3. NotificationCenter broadcasts "ThemeDidChange"
  4. ThemeManager receives notification and updates @published property
  5. DroppedApp observes change and applies new preferredColorScheme

This architecture ensures immediate theme application without requiring app restart while maintaining clean separation of concerns.

Original prompt

The user has attached the following files as relevant context:

  • .github/instructions/run.instructions.md
  • .github/instructions/swift.instructions.md
  • .github/copilot-instructions.md
  • docs/memory.md

User: Add the ability to theme with light and dark themes

Created from VS Code via the [GitHub Pull Request](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github) extension.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add support for light and dark themes Add light and dark theme support with user-selectable preferences Oct 8, 2025
Copilot AI requested a review from pierceboggan October 8, 2025 16:34
Copilot finished work on behalf of pierceboggan October 8, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants