Skip to content

Commit

Permalink
removing consume keyWord
Browse files Browse the repository at this point in the history
  • Loading branch information
EngOmarElsayed committed Mar 15, 2024
1 parent 2988677 commit 95dcc94
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/UserDefaults/UserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ extension UserDefault {
let data = container.object(forKey: key)

if let data = data as? Data {
return decode(consume data) ?? defaultValue
return decode(data) ?? defaultValue
} else {
return consume data as? Value ?? defaultValue
return data as? Value ?? defaultValue
}
}

Expand All @@ -67,7 +67,7 @@ extension UserDefault {
private func encode(newValue: DefaultsCustomDataType) {
let encoder = JSONEncoder()
let data = try? encoder.encode(newValue)
container.set(consume data, forKey: key)
container.set(data, forKey: key)
}

private func decode(_ data: Data) -> Value? {
Expand Down

0 comments on commit 95dcc94

Please sign in to comment.