How mythicapp/mythic works
Project type and purpose
• From the file tree and README, Mythic is a Swift/SwiftUI macOS application—an open-source game launcher and GUI frontend for the Legendary CLI.
• It coordinates multiple subsystems (Engine for DirectX support, Wine, Legendary CLI, Epic Games auth, Discord RPC, auto-updates via Sparkle) to manage, download, and launch Windows games on macOS.
High-level architecture layers
• Presentation Layer
• All SwiftUI views under Mythic/Views (Navigation, Unified modules, Sheets, Windows)
• MythicApp.swift, ContentView.swift → entry point and root view
• ViewModel / Presentation Logic
• ViewModel classes in Mythic/Views/Unified/Models (e.g., GameCardVM, GameListEvoVM)
• Bind the UI to business services
• Domain/Business Logic Layer
• Mythic/Utilities
– Engine interfaces (Engine.swift, EngineExt.swift) for DirectX
– LegendaryInterface.swift & LegendaryInterfaceExt.swift call the embedded Legendary Python CLI
– WineInterface.swift & WineInterfaceExt.swift invoke Wine to run Windows binaries
– LocalGames.swift / LocalGamesExt.swift manage scanning local game containers
– VariableManager.swift, FileLocations.swift manage env vars and file paths
– SparkleController.swift for auto-update checks
– NetworkMonitor.swift for offline/online state
• Data Access / Utilities
• JSON parsing via SwiftyJSON
• ZIP handling via ZIPFoundation
• SemanticVersion for version parsing
• Caching images via swiftui-cached-asyncimage
• Persistence
• UserDefaults (via extension) for settings
• On-disk container metadata and downloaded game files
• External / Third-party Dependencies
• Legendary CLI (embedded Python environment in Mythic/legendary/_internal)
• Wine (dynamic libs under Mythic/Utilities/Wine)
• Metal-based UI libs: ColorfulX, Glur
• Sparkle (auto-updates)
• Discord RPC (via SwordRPC extension)
• Epic Games WebAuth (via SwiftUI WebView)
Relationships and interactions
• UI Layer → ViewModels → calls Business Logic services
• Business Logic → invokes external engines/CLIs (Engine, Legendary, Wine)
• Business Logic → reads/writes container metadata & game downloads on the file system
• Business Logic → persists settings to UserDefaults
• SparkleController periodically checks for updates → notifies UI
• NetworkMonitor broadcasts connectivity changes to Presentation Layer
• Epic WebAuth window issues authentication → returns tokens to LegendaryInterface
Architectural patterns & design principles
• MVVM: Views bind to ViewModels, which orchestrate domain services
• Layered architecture: clear separation of Presentation, Domain Logic, Data/Infrastructure, External Services
• Dependency inversion: protocols/extensions allow mocking Legendary/Wine interfaces for testing
• Single responsibility: each Utility class focuses on one subsystem (Engine, Wine, Legendary, Networking)