It's just a middleware for UserDefaults to write and read values by easy way
in default way to save the user name, we write this
letuserDefaults=UserDefaults.standard
// writing the value
userDefaults.set("Guest", forKey:"UserNameKey")
// reading the value
userDefaults.value(forKey:"UserNameKey")as?Stringbut using the subscripts, you can create the key and use it for write or read the value
letuserDefaults=UserDefaults.standard
letuserNameKey=UserDefaults.Key<String>("userNameKey", default:"Guest")
// reading the value letdefaultValue=userDefaults[.userNameKey]letnewValue="Jack"
// writing the value
userDefaults[.userNameKey]= newValueand you can add more keys like this
extensionUserDefaults.Keys{staticletdidUserSeeSplash=Key<Bool>("didUserSeeSplash", default:false)staticletuserName=Key<String>("userName", default:"Guest")staticletcouterOfArticleSeen=Key<Int>("couterOfSeen", default:0)staticletpercentage=Key<Double>("couterOfSeen", default:0.0)}