# scorpio7736/mtg-pack-opener architecture

> Architecture diagram of the GitHub repository scorpio7736/mtg-pack-opener, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/scorpio7736/mtg-pack-opener
- Repository: https://github.com/scorpio7736/mtg-pack-opener

## Overview

MTG Pack Opener is an unofficial SwiftUI simulator for opening virtual Magic: The Gathering packs and collecting the resulting cards locally by player profile. The principal workflow fetches random cards from Scryfall, adds them to the active profile’s collection, then presents interactive reveals; the Cards area browses saved quantities in grid or list form. Other documented capabilities include double-faced cards, settings and reference screens, connectivity awareness, and local notifications. Connections follow README statements and shown excerpts; unsampled implementation details are not inferred.

Main entry points: [`MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Views/Main_View.swift`](https://github.com/scorpio7736/mtg-pack-opener/blob/main/MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Views/Main_View.swift) (Tabs and Navigation), [`MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Services/Pack_View_Service.swift`](https://github.com/scorpio7736/mtg-pack-opener/blob/main/MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Services/Pack_View_Service.swift) (Pack Fetching), [`MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Views/Pack_View.swift`](https://github.com/scorpio7736/mtg-pack-opener/blob/main/MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Views/Pack_View.swift) (Pack Screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pack["Pack Opening"]
  node_pack_ui["Pack Screen<br/>[Pack_View.swift]"]
  node_fetch["Pack Fetching"]
  node_card["Card Records"]
  node_face["Card Faces"]
  node_display["Card Display Data"]
  node_reveal["Card Reveal"]
  node_sound["Sound Effects"]
end

subgraph group_collection["Collection"]
  node_collection_service["Collection Management"]
  node_storage[("Local Collection")]
  node_grid["Grid Browser"]
  node_list["List Browser"]
  node_detail["Card Details"]
end

subgraph group_profiles["Profiles"]
  node_profile["Profile Management"]
  node_profile_model["Profile Data"]
  node_select_profile["Profile Selector"]
end

subgraph group_app["App Experience"]
  node_main["Tabs and Navigation<br/>[Main_View.swift]"]
  node_settings["Settings"]
  node_connectivity["Connectivity Status"]
  node_notifications["Local Notifications"]
  node_reference["Reference Screens"]
end

node_user(("Player"))
node_scryfall{{"Scryfall API"}}

node_user -->|"uses"| node_main
node_main -->|"opens Packs"| node_pack_ui
node_pack_ui -->|"requests pack"| node_fetch
node_fetch -->|"fetches cards"| node_scryfall
node_scryfall -->|"returns records"| node_fetch
node_fetch -->|"decodes cards"| node_card
node_card -->|"contains faces"| node_face
node_user -->|"reveals cards"| node_reveal
node_reveal -.->|"plays effects"| node_sound
node_fetch -->|"adds opened cards"| node_collection_service
node_collection_service -->|"persists locally"| node_storage
node_main -->|"opens Cards"| node_grid
node_main -->|"offers list mode"| node_list
node_grid -.->|"loads collection"| node_collection_service
node_list -.->|"loads collection"| node_collection_service
node_grid -->|"opens card"| node_detail
node_detail -->|"deletes copies"| node_collection_service
node_detail -.->|"selects image"| node_display
node_user -.->|"manages profiles"| node_profile
node_profile -.->|"uses profile data"| node_profile_model
node_user -.->|"chooses profile"| node_select_profile
node_main -->|"opens Settings"| node_settings
node_settings -.->|"opens reference"| node_reference
node_user -.->|"network context"| node_connectivity
node_settings -.->|"configures reminders"| node_notifications

click node_main "https://github.com/scorpio7736/mtg-pack-opener/blob/main/MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Views/Main_View.swift"
click node_pack_ui "https://github.com/scorpio7736/mtg-pack-opener/blob/main/MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Views/Pack_View.swift"
click node_fetch "https://github.com/scorpio7736/mtg-pack-opener/blob/main/MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Services/Pack_View_Service.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pack_ui,node_fetch,node_card,node_face,node_display,node_reveal,node_sound toneBlue
class node_collection_service,node_storage,node_grid,node_list,node_detail toneAmber
class node_profile,node_profile_model,node_select_profile,node_scryfall toneMint
class node_main,node_settings,node_connectivity,node_notifications,node_reference toneRose
class node_user toneIndigo
```

## Components

### Pack Opening

- [Pack Screen](https://github.com/scorpio7736/mtg-pack-opener/blob/main/MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Views/Pack_View.swift): `MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Views/Pack_View.swift`
- [Pack Fetching](https://github.com/scorpio7736/mtg-pack-opener/blob/main/MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Services/Pack_View_Service.swift): `MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Services/Pack_View_Service.swift`
- **Card Records**
- **Card Faces**
- **Card Display Data**
- **Card Reveal**
- **Sound Effects**

### Collection

- **Collection Management**
- **Local Collection**
- **Grid Browser**
- **List Browser**
- **Card Details**

### Profiles

- **Profile Management**
- **Profile Data**
- **Profile Selector**

### App Experience

- [Tabs and Navigation](https://github.com/scorpio7736/mtg-pack-opener/blob/main/MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Views/Main_View.swift): `MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Views/Main_View.swift`
- **Settings**
- **Connectivity Status**
- **Local Notifications**
- **Reference Screens**

### Other components

- **Player**
- **Scryfall API**

## Connections

- Player → Tabs and Navigation: uses (evidence: `README.md`)
- Tabs and Navigation → Pack Screen: opens Packs (evidence: `README.md`)
- Pack Screen → Pack Fetching: requests pack (evidence: `README.md`)
- Pack Fetching → Scryfall API: fetches cards (evidence: `MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Services/Pack_View_Service.swift`)
- Scryfall API → Pack Fetching: returns records (evidence: `README.md`)
- Pack Fetching → Card Records: decodes cards (evidence: `MTGPackOpener-iOS/MTGPackOpener/MTGPackOpener/Services/Pack_View_Service.swift`)
- Card Records → Card Faces: contains faces
- Player → Card Reveal: reveals cards (evidence: `README.md`)
- Card Reveal → Sound Effects: plays effects
- Pack Fetching → Collection Management: adds opened cards (evidence: `README.md`)
- Collection Management → Local Collection: persists locally
- Tabs and Navigation → Grid Browser: opens Cards (evidence: `README.md`)
- Tabs and Navigation → List Browser: offers list mode (evidence: `README.md`)
- Grid Browser → Collection Management: loads collection
- List Browser → Collection Management: loads collection
- Grid Browser → Card Details: opens card
- Card Details → Collection Management: deletes copies
- Card Details → Card Display Data: selects image
- Player → Profile Management: manages profiles
- Profile Management → Profile Data: uses profile data
- Player → Profile Selector: chooses profile
- Tabs and Navigation → Settings: opens Settings (evidence: `README.md`)
- Settings → Reference Screens: opens reference
- Player → Connectivity Status: network context (evidence: `README.md`)
- Settings → Local Notifications: configures reminders
