krz/daybyday

iOS learning games for young children: days, months, seasons, numbers, letters, animals and more. education ios kids swift https://krz.sh/apps/daybyday/

DayByDay/Profiles/AnswerRecord.swift

main
daybyday/DayByDay/Profiles/AnswerRecord.swift history · blame · raw

32 lines · 866 bytes

1 symbol in this file
 1//
 2//  AnswerRecord.swift
 3//  DayByDay
 4//
 5
 6import Foundation
 7import SwiftData
 8
 9/// One answer a child gave to a question.
10@Model
11final class AnswerRecord {
12    var categoryRaw: Int
13    var itemID: String
14    /// The item the child tapped. Nil for answers recorded before part 2.
15    var chosenID: String?
16    /// `Game.rawValue`. Nil for answers recorded before part 2.
17    var gameRaw: String?
18    var isCorrect: Bool
19    var timestamp: Date
20    var profile: Profile?
21
22    init(categoryRaw: Int, itemID: String, chosenID: String? = nil, gameRaw: String? = nil,
23         isCorrect: Bool, timestamp: Date, profile: Profile) {
24        self.categoryRaw = categoryRaw
25        self.itemID = itemID
26        self.chosenID = chosenID
27        self.gameRaw = gameRaw
28        self.isCorrect = isCorrect
29        self.timestamp = timestamp
30        self.profile = profile
31    }
32}