60 lines
1.8 KiB
Swift
60 lines
1.8 KiB
Swift
//
|
|
// IOS_studyApp.swift
|
|
// IOS_study
|
|
//
|
|
// Created by CC-star on 2025/6/3.
|
|
//
|
|
|
|
import SwiftUI
|
|
import LeanCloud
|
|
|
|
@main
|
|
struct IOS_studyApp: App {
|
|
// init(){
|
|
//
|
|
// }
|
|
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
|
|
@State var hud = HUD()
|
|
@State var tabbarVM = TabBarViewModel()
|
|
@State var signInPhoneVM = SignInPhoneViewModel()
|
|
@State var reviewVM = ReviewViewModel()
|
|
@State var ProfileVM = ProfileViewModel()
|
|
@State var nwMonitor = NetworkMonitor()
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
TaBarView()
|
|
// PostCompanyView(naviPath: .constant(NavigationPath()))
|
|
.hud(isPresented: $hud.isPresented){
|
|
Text(hud.title)
|
|
}
|
|
//注入
|
|
.environment(reviewVM)
|
|
.environment(ProfileVM)
|
|
.environment(signInPhoneVM)
|
|
.environment(hud)
|
|
.environment(tabbarVM)
|
|
.environment(nwMonitor)
|
|
}
|
|
}
|
|
}
|
|
|
|
@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)
|
|
|
|
|
|
do {
|
|
try LCApplication.default.set(
|
|
id: kAppID,
|
|
key: kAppKey,
|
|
serverURL: kServerURLStr)
|
|
} catch {
|
|
print(error)
|
|
}
|
|
return true
|
|
}
|
|
}
|