-3

The use case is that I want to separate my UserDefaults (different business logic may require Userdefaults to be grouped separately) by an identifier just like Android's SharedPreferences. For example, when a user in my app clicks on logout button, I would want to clear his account related defaults but not location of the the device saved in UserDefaults.

sandpat
  • 1,478
  • 12
  • 30
  • 1
    What’s so unclear about this question? I edited it, had got an answer much before editing that I accepted. – sandpat Jun 06 '18 at 14:29

1 Answers1

2

You can use a Suite name

let user = UserDefaults(suiteName:"User")

let location = UserDefaults(suiteName:"Location")

vicegax
  • 4,709
  • 28
  • 37