iOS Questions (Storage Types)

 UserDefaults 

  • are meant to be used to store small pieces of data which persist across app launches. UserDefaults lets you store key-value pairs, where a key is always a String and value can be one of the following data types: Data, String, Number, Date, Array or Dictionary. 
  • UserDefaults All the contents saved by NSUserDefaults is saved inside a plist file that can be found under Library -> Preferences -> $AppBundleId.
  • Internally, the user defaults are saved in a .plist

  • Thread safe (you can read and write values from any thread), without worrying about synchronization
    • UserDefaults is shared between the app and the app extensions
    • UserDefaults is not encrypted

    Keychain Services
    Apple’s Keychain Services is a mechanism for storing small, sensitive data such as passwords, encryption keys or user tokens in a secure and protected manner. 

    • Thread safety

    More : https://www.iosapptemplates.com/blog/ios-development/data-persistence-ios-swift

    Comments

    Popular posts from this blog

    iOS Questions (Swift Programming Language)

    Dispatch techniques: Dynamic dispatch and Static Dispatch

    What’s the difference between var and let? Which one would you choose for properties in a struct and Class why?