//
//  IOS_studyApp.swift
//  IOS_study
//
//  Created by CC-star on 2025/6/3.
//

import SwiftUI

@main
struct IOS_studyApp: App {
   //   init(){
   //
   //   }
   @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
   @State var hud = HUD()
   @State var tabbarVM = TabBarViewModel()
   @State var plJobVM = PLJobViewModel()
   var body: some Scene {
      WindowGroup {
         TaBarView()
            .hud(isPresented: $hud.isPresented){
               Text(hud.title)
            }
            .environment(hud)
            .environment(tabbarVM)
            .environment(plJobVM)
      }
   }
}

@MainActor class AppDelegate: NSObject, UIApplicationDelegate {
   func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
      UISegmentedControl.appearance().selectedSegmentTintColor = .accent
      UISegmentedControl.appearance().setTitleTextAttributes([.font: UIFont.systemFont(ofSize: 17,weight: .medium),.foregroundColor: UIColor(Color.aTC)], for: .normal)
      UISegmentedControl.appearance().setTitleTextAttributes([.font: UIFont.systemFont(ofSize: 17,weight: .semibold),.foregroundColor: UIColor(Color.white)], for: .selected)
      return true
   }
}
