Skip to content

Commit

Permalink
Update RefdsDefaults.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelesantos committed Aug 24, 2024
1 parent 3b3de76 commit 0cf8f33
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/RefdsShared/Data/RefdsDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ public struct RefdsDefaults<Value> {
let key: String
var defaultValue: Value? = nil

public init(
key: String,
defaultValue: Value? = nil
) {
self.key = key
self.defaultValue = defaultValue
}

public var wrappedValue: Value? {
get { Self.defaults.object(forKey: key) as? Value }
set { Self.defaults.set(newValue, forKey: key) }
Expand Down

0 comments on commit 0cf8f33

Please sign in to comment.