A best practice codebase for saving data in in user defaults using a @propertywrapper
you can save any types of data into user defaults using this code
- Codable Friendly
- Generic
- Clean
- Much less code
- Copy these two swift files in your project.
- add values you want to save in DataManager file.
- add a setter like the example.
- for getting a value you can either write a getter or just call the variable you add like:
let data = DataManager.shared.dataYouWantToSave