diff --git a/password/data/model/PasswordAttempt.swift b/password/data/model/PasswordAttempt.swift new file mode 100644 index 0000000..46c3c42 --- /dev/null +++ b/password/data/model/PasswordAttempt.swift @@ -0,0 +1,28 @@ +// +// PasswordAttempt.swift +// password +// +// Created by Markus Thielker on 17.01.25. +// + +import Foundation +import SwiftData + +@Model +class PasswordAttempt: Identifiable { + + @Attribute(.unique) var id: UUID + var password: UUID + + var timestamp: Date + var isSuccessful: Bool + var typingTime: Double + + init(id: UUID = UUID(), password: UUID, timestamp: Date = Date(), isSuccessful: Bool, typingTime: Double) { + self.id = id + self.password = password + self.timestamp = timestamp + self.isSuccessful = isSuccessful + self.typingTime = typingTime + } +} diff --git a/password/passwordApp.swift b/password/passwordApp.swift index d40bad9..eaac38b 100644 --- a/password/passwordApp.swift +++ b/password/passwordApp.swift @@ -60,7 +60,7 @@ struct passwordApp: App { authenticate() } } - .modelContainer(for: [Password.self]) + .modelContainer(for: [Password.self, PasswordAttempt.self]) } }