Phase 1.2:BundleConfig 读 ChannelConfig.plist 完成 11 项渠道注入加载
- 新增 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 建立后补齐
This commit is contained in:
@@ -12,6 +12,23 @@ 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 {
|
||||
|
||||
Reference in New Issue
Block a user