Refactor AppServices into grouped bundles and document DI conventions.

Centralize dependency wiring with Session/Context/Network/UI/Runtime bundles, unify leaf ViewControllers on appServices, and add a test initializer with AppServicesTests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-26 15:24:25 +08:00
parent d99a5b1bf8
commit 24a7339b68
10 changed files with 385 additions and 114 deletions

View File

@ -9,8 +9,6 @@ import UIKit
/// ViewController ToastLoading ViewModel
@MainActor
enum ViewControllerHelpers {
static var services: AppServices { AppServices.shared }
/// ViewModel onChange deinit
static func bind(onChange: (() -> Void)?, owner: AnyObject, handler: @escaping () -> Void) {
onChange?()

View File

@ -42,7 +42,8 @@ final class TitleSubtitleTableViewCell: UITableViewCell {
/// UITableView Diffable ViewModel onChange
class ModuleTableViewController: UIViewController, UITableViewDelegate {
let services = AppServices.shared
/// 访 `appServices`
var services: AppServices { appServices }
let tableView = UITableView(frame: .zero, style: .insetGrouped)
private let refreshControl = UIRefreshControl()
private let activityIndicator = UIActivityIndicatorView(style: .medium)
@ -289,7 +290,8 @@ private extension Array {
/// UICollectionView Diffable
class ModuleCollectionViewController: UIViewController {
let services = AppServices.shared
/// 访 `appServices`
var services: AppServices { appServices }
let collectionView: UICollectionView
private let refreshControl = UIRefreshControl()
private let activityIndicator = UIActivityIndicatorView(style: .medium)