Add persistence of selected currencies to disk via SQLite

This commit is contained in:
2024-11-20 20:13:54 +02:00
parent 303cad1076
commit da21b78588
6 changed files with 224 additions and 10 deletions

View File

@@ -11,6 +11,9 @@ let logger: Logger = Logger(subsystem: "xyz.tyiu.SatsPrice", category: "SatsPric
/// 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.
@@ -19,7 +22,7 @@ public struct RootView : View {
}
public var body: some View {
ContentView()
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")