README.md

tl;dr

You love Swift's Codable protocol and use it everywhere, who doesn't! Here is an easy and very light way to store and retrieve -reasonable amount 😅- of Codable objects, in a couple lines of code!

Installation

CocoaPods (Recommended)

To integrate UserDefaultsStore into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'UserDefaultsStore'

Carthage

To integrate UserDefaultsStore into your Xcode project using Carthage, specify it in your Cartfile:

github "omaralbeik/UserDefaultsStore" ~> 1.0

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but UserDefaultsStore does support its use on supported platforms.

Once you have your Swift package set up, adding UserDefaultsStore as a dependency is as easy as adding it to the dependencies value of your Package.swift.

Notice how User uses Int for its id, while Laptop uses String, in fact the id can be any Hashable type. UserDefaults uses Swift keypaths to refer to properties without actually invoking them. Swift rocks 🤘