Skip to content

Commit

Permalink
Use enum for keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunn committed Apr 11, 2024
1 parent c09a2b3 commit 8703d5a
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public class DataBrokerProtectionSchedulerErrorCollection: NSObject, NSSecureCod
for the IPC layer
*/

private enum NSSecureCodingKeys {
static let oneTimeError = "oneTimeError"
static let operationErrors = "operationErrors"
}

public let oneTimeError: Error?
public let operationErrors: [Error]?

Expand All @@ -50,13 +55,13 @@ public class DataBrokerProtectionSchedulerErrorCollection: NSObject, NSSecureCod
}

public func encode(with coder: NSCoder) {
coder.encode(oneTimeError, forKey: "oneTimeError")
coder.encode(operationErrors, forKey: "operationErrors")
coder.encode(oneTimeError, forKey: NSSecureCodingKeys.oneTimeError)
coder.encode(operationErrors, forKey: NSSecureCodingKeys.operationErrors)
}

public required init?(coder: NSCoder) {
oneTimeError = coder.decodeObject(forKey: "oneTimeError") as? Error
operationErrors = coder.decodeObject(forKey: "operationErrors") as? [Error]
oneTimeError = coder.decodeObject(forKey: NSSecureCodingKeys.oneTimeError) as? Error
operationErrors = coder.decodeObject(forKey: NSSecureCodingKeys.operationErrors) as? [Error]
}
}

Expand Down

0 comments on commit 8703d5a

Please sign in to comment.