Files
sats-price/Sources/SatsPrice/SatsPriceApp.swift

47 lines
1.5 KiB
Swift

// This is free software: you can redistribute and/or modify it
// under the terms of the GNU General Public License 3.0
// as published by the Free Software Foundation https://fsf.org
import Foundation
import OSLog
import SwiftUI
let logger: Logger = Logger(subsystem: "xyz.tyiu.SatsPrice", category: "SatsPrice")
/// The Android SDK number we are running against, or `nil` if not running on Android
let androidSDK = ProcessInfo.processInfo.environment["android.os.Build.VERSION.SDK_INT"].flatMap({ Int($0) })
/// The shared data model.
private let model = try! SatsPriceModel(url: URL.documentsDirectory.appendingPathComponent("satsprice.sqlite"))
/// The shared top-level view for the app, loaded from the platform-specific App delegates below.
///
/// The default implementation merely loads the `ContentView` for the app and logs a message.
public struct RootView : View {
public init() {
}
public var body: some View {
ContentView(model: model)
.task {
logger.log("Welcome to Skip on \(androidSDK != nil ? "Android" : "Darwin")!")
logger.warning("Skip app logs are viewable in the Xcode console for iOS; Android logs can be viewed in Studio or using adb logcat")
}
}
}
#if !SKIP
public protocol SatsPriceApp : App {
}
/// The entry point to the SatsPrice app.
/// The concrete implementation is in the SatsPriceApp module.
public extension SatsPriceApp {
var body: some Scene {
WindowGroup {
RootView()
}
}
}
#endif