Set value in Preference iOS

Set value in Userdefaults in swift 3 or later

UserDefaults.standard.set("ENGLISH", forKey: "LANGUAGE")
UserDefaults.standard.synchronize()

Get value in Userdefaults in swift 3 or later

 if let language = UserDefaults.standard.string(forKey: "LANGUAGE") {
     print(language)
 }