 //  Redistributions of files must retain the above copyright notice.
 //
 
-import Foundation
+import UIKit
 
 /// A simplified way to get/set user defaults.
 ///

    /// 4. nil.
    public mutating func get() -> Type? {
        if !hasCachedValue {
            if defaultValue is NSURL {
                hasCachedValue = true
                value = UserDefaults.standard.url(forKey: name) as? Type
            } else if defaultValue is Bool {
                hasCachedValue = true
                value = UserDefaults.standard.bool(forKey: name) as? Type
            } else if defaultValue is Int {
                hasCachedValue = true
                value = UserDefaults.standard.integer(forKey: name) as? Type
            } else if defaultValue is Double {
                hasCachedValue = true
                value = UserDefaults.standard.double(forKey: name) as? Type
            } else if defaultValue is Float {
                hasCachedValue = true
                value = UserDefaults.standard.float(forKey: name) as? Type
            } else if defaultValue is String {
                hasCachedValue = true
                value = UserDefaults.standard.string(forKey: name) as? Type
            } else {
                // we don't always have to archive Array and Dictionary
                // but this is easier

    public mutating func set(_ value: Type?) {
        self.value = value
        hasCachedValue = true
        if Type.self == URL.self
            || Type.self == Bool.self
            || Type.self == Decimal.self
            || Type.self == Double.self
            || Type.self == Float.self
            || Type.self == CGFloat.self
            || Type.self == String.self {
            hasCachedValue = true
            if let value = value {
                UserDefaults.standard.set(value, forKey: name)
