How xitrix/itorrent works
Based on your provided file tree and README, this is an iOS torrent client app (iTorrent) that uses a modular MVVM architecture with clearly separated UI (screens, components, view controllers), business logic (services and core handlers), and low-level integration (LibTorrent, Firebase, web server, etc.). In addition, there is a separate widget extension (ProgressWidget) that provides live activity/dynamic island functionality. The project also uses submodules for libraries (e.g., GCDWebServer, GoogleAdsSdk, MVVMFoundation) that form part of its infrastructure.
• iTorrent Main App:
• UI Layer: This includes all the directories under “iTorrent/Components”, “iTorrent/Screens”, and the “iTorrent/Core” layer. Here, you see various screens such as Preferences, Torrent Details, TorrentList, RSS, etc.
• Business Logic/Services: Under “iTorrent/Services” (e.g., TorrentService, ImageCache, BackgroundService, Patreon, and TrackersListService) which handle network operations, torrent monitoring, storage, and external communications.
• Supporting Utilities: Under “iTorrent/Utils” which host common helpers, extensions, and MVVM utilities.
• App Lifecycle/Middleware: Found in “iTorrent/Core” (including the AppDelegate and SceneDelegate) which coordinate app startup, background refresh, notifications, and configurations.
• ProgressWidget Extension:
• This component (in the “ProgressWidget” directory) provides the live activity, widget background, assets, and attributes to support the dynamic island display and widget updates.
• External/Third-party Modules:
• Submodules: such as GoogleAdsSdk, LibTorrent, MVVMFoundation, and GCDWebServer, integrated as libraries. These support torrent downloading via LibTorrent, ad services via GoogleAds, and additional functionality like web server capabilities.
Relationships and Data Flow Between Components
• UI Layer (Screens/Views/Controllers) communicates user actions (e.g., adding torrents, changing settings) to the Business Logic layer.
• The Business Logic (Services) receives commands from the UI layer. For example, TorrentService handles operations such as starting downloads or monitoring progress, and in turn, it may interact with the LibTorrent library.
• Background Services (in Services/BackgroundService) monitor operations such as downloads, network changes, and trigger notifications.
• The widget extension (ProgressWidget) listens to live data (likely via services or notifications published by the main app) to update its UI components.
• External modules such as Firebase Analytics/Crashlytics and GoogleAdsKit plug into the services for logging, metrics, and monetization.
• Utility components (in Utils and Extensions) support seamless data transformation, asynchronous communication (using Combine), and UI enhancements.
Architectural Patterns / Design Principles
• Service Orientation: Several services (TorrentService, BackgroundService, etc.) encapsulate core functionality. Represent these as backend “service” components that the UI interacts with via defined interfaces.
• Dependency Management: Show a layer or note how external libraries (LibTorrent, Firebase, GoogleAdsSdk, MVVMFoundation) are integrated into the overall system.
Technology and Framework Labels
• Swift as the primary programming language.
• iOS-specific architectural components like AppDelegate, SceneDelegate, and widget extension.
• Use of Combine for reactive programming patterns (look for Combine extensions and CombineLatest files in Utils).
• Integration with Firebase and GoogleAds for analytics, crash reporting, and monetization.
• Use of third-party libraries (e.g., LibTorrent for underlying torrent functionality).