- 新增 ylgamehall/Source/Resource/BundleConfig.swift
- 11 个 public let 属性(qiniuDomain / gameId / channel / gameDir
/ gameStart / gameConfig / market / agent / appVersion / other
/ appleConfig)
- public init(bundle: Bundle = .main) —— 默认走 main bundle,单测
可注入 mock bundle 验证不同 plist fixture
- PropertyListSerialization 反序列化 ChannelConfig.plist
- final class + Sendable(all-let,String 是 Sendable,Swift 6
严格并发下编译器静态校验通过)
- 单例 BundleConfig.shared,业务统一通过此访问
- RootViewController.viewDidLoad 加烟雾测试 print 11 项值,首次运行
真机/模拟器即可在 console 验证读取正确
- BuildProject 通过,synchronized group 自动收编 BundleConfig.swift
为 source(.swift 文件类型走 SwiftCompile,不再卡 plist 那样的
resource 扁平化问题)
- 单元测试待 Phase 0.2 单测 target 建立后补齐
44 lines
1.2 KiB
Swift
44 lines
1.2 KiB
Swift
//
|
|
// RootViewController.swift
|
|
// ylgamehall
|
|
//
|
|
// M0 阶段临时根控制器,后续将被 Coordinator + LobbyViewController 替换。
|
|
//
|
|
|
|
import UIKit
|
|
|
|
final class RootViewController: UIViewController {
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
view.backgroundColor = .black
|
|
|
|
// Phase 1.2 烟雾测试:打印 ChannelConfig.plist 的 11 项渠道注入值
|
|
let cfg = BundleConfig.shared
|
|
print("""
|
|
[BundleConfig] 渠道注入读取结果:
|
|
qiniuDomain = \(cfg.qiniuDomain)
|
|
gameId = \(cfg.gameId)
|
|
channel = \(cfg.channel)
|
|
gameDir = \(cfg.gameDir)
|
|
gameStart = \(cfg.gameStart)
|
|
gameConfig = \(cfg.gameConfig)
|
|
market = \(cfg.market)
|
|
agent = \(cfg.agent)
|
|
appVersion = \(cfg.appVersion)
|
|
other = "\(cfg.other)"
|
|
appleConfig = "\(cfg.appleConfig)"
|
|
""")
|
|
}
|
|
|
|
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
|
|
.landscape
|
|
}
|
|
|
|
override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
|
|
.landscapeRight
|
|
}
|
|
|
|
override var prefersStatusBarHidden: Bool { false }
|
|
}
|