From 0cf8f33f0e71c64f7dc2ebd83c0cbadb4abb71dd Mon Sep 17 00:00:00 2001 From: Rafael Escaleira Date: Sat, 24 Aug 2024 12:26:17 -0400 Subject: [PATCH] Update RefdsDefaults.swift --- Sources/RefdsShared/Data/RefdsDefaults.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/RefdsShared/Data/RefdsDefaults.swift b/Sources/RefdsShared/Data/RefdsDefaults.swift index 9457f0d..6d6a0cf 100644 --- a/Sources/RefdsShared/Data/RefdsDefaults.swift +++ b/Sources/RefdsShared/Data/RefdsDefaults.swift @@ -5,6 +5,14 @@ public struct RefdsDefaults { 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) }