This commit is contained in:
Trey t
2025-12-09 23:36:57 -06:00
parent 316513e516
commit 3a10b4b8d6
1586 changed files with 0 additions and 7710 deletions

View File

@@ -1,59 +0,0 @@
//
// OnboardingData.swift
// Feels (iOS)
//
// Created by Trey Tartt on 1/22/22.
//
import Foundation
import UserNotifications
// this is getting passed around and filled out
// class and vars
final class OnboardingData: NSObject, ObservableObject, Codable {
@Published var date: Date = Date()
@Published var inputDay: DayOptions = .Today
enum CodingKeys: CodingKey {
case date, inputDay
}
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(date, forKey: .date)
try container.encode(inputDay, forKey: .inputDay)
}
required init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
date = try container.decode(Date.self, forKey: .date)
inputDay = try container.decode(DayOptions.self, forKey: .inputDay)
}
override init() { }
}
extension OnboardingData: RawRepresentable {
convenience init?(rawValue: String) {
guard let data = rawValue.data(using: .utf8),
let result = try? JSONDecoder().decode(OnboardingData.self, from: data)
else {
return nil
}
self.init()
self.date = result.date
self.inputDay = result.inputDay
}
public var rawValue: String {
guard let data = try? JSONEncoder().encode(self),
let result = String(data: data, encoding: .utf8)
else {
return "[]"
}
return result
}
}