You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1014 B
35 lines
1014 B
//
|
|
// AppSettings.swift
|
|
// PadelClub
|
|
//
|
|
// Created by Razmig Sarkissian on 26/03/2024.
|
|
//
|
|
|
|
import Foundation
|
|
import LeStorage
|
|
import SwiftUI
|
|
|
|
@Observable
|
|
final class AppSettings: MicroStorable {
|
|
|
|
var lastDataSource: String? = nil
|
|
var didCreateAccount: Bool = false
|
|
var didRegisterAccount: Bool = false
|
|
|
|
required init() {
|
|
|
|
}
|
|
|
|
required init(from decoder: Decoder) throws {
|
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
|
lastDataSource = try container.decodeIfPresent(String.self, forKey: ._lastDataSource)
|
|
didCreateAccount = try container.decodeIfPresent(Bool.self, forKey: ._didCreateAccount) ?? false
|
|
didRegisterAccount = try container.decodeIfPresent(Bool.self, forKey: ._didRegisterAccount) ?? false
|
|
}
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case _lastDataSource = "lastDataSource"
|
|
case _didCreateAccount = "didCreateAccount"
|
|
case _didRegisterAccount = "didRegisterAccount"
|
|
}
|
|
}
|
|
|