         }
     }
 
-    fileprivate func userDefaultsKey(forProperty property: Property) -> String {
+    private func userDefaultsKey(forProperty property: Property) -> String {
         return "\(uniqueIdentifierKey).\(property)"
     }
 
     private func saveDefaultValue(_ property: Property) {
         guard let object = self.value(forKeyPath: property) else { return }
-        let archivedObject = NSKeyedArchiver.archivedData(withRootObject: object)
+        let archivedObject = try? NSKeyedArchiver.data(object: object)
         defaultValues[property] = archivedObject
     }
 
     private func fillProperty(_ property: Property) {
         if let data = userDefaults.object(forKey: userDefaultsKey(forProperty: property)) as? Data {
-            let value = NSKeyedUnarchiver.unarchiveObject(with: data)
+            let value = NSKeyedUnarchiver.object(data: data)
             self.setValue(value, forKey: property)
         }
     }

            userDefaults.removeObject(forKey: usKey)
            return
        }
        let archivedObject = NSKeyedArchiver.archivedData(withRootObject: object)
        userDefaults.set(archivedObject, forKey: usKey)
        userDefaults.synchronize()
    }
}

import Foundation

public protocol SharedInstanceType: class {
    init(classType: AnyClass)
    func clearInstances()
}

private var userSettingsSingletons = [String: SharedInstanceType]()
