46 lines
1.1 KiB
Swift
46 lines
1.1 KiB
Swift
#if !os(macOS)
|
|
import BurrowUI
|
|
import SwiftUI
|
|
#if os(iOS)
|
|
import UIKit
|
|
#endif
|
|
|
|
@MainActor
|
|
@main
|
|
struct BurrowApp: App {
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
#if os(iOS)
|
|
BurrowView(appIconManager: UIKitAppIconManager())
|
|
#else
|
|
BurrowView()
|
|
#endif
|
|
}
|
|
}
|
|
}
|
|
|
|
#if os(iOS)
|
|
@MainActor
|
|
private struct UIKitAppIconManager: AppIconManaging {
|
|
var supportsAlternateIcons: Bool {
|
|
UIApplication.shared.supportsAlternateIcons
|
|
}
|
|
|
|
var alternateIconName: String? {
|
|
UIApplication.shared.alternateIconName
|
|
}
|
|
|
|
func setAlternateIconName(_ iconName: String?) async throws {
|
|
try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<Void, any Error>) in
|
|
UIApplication.shared.setAlternateIconName(iconName) { error in
|
|
if let error {
|
|
continuation.resume(throwing: error)
|
|
} else {
|
|
continuation.resume(returning: ())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|