Kotlin shared preferences
Welcome to Kotlin! Consider this.

// Define constructor this way
class UserSettings(context: Context) {
    // Prefixes for fields are rather uncommon in the Kotlin world.
    // You could remove the type declaration here - Kotlin will infer it for you
    private val prefs: SharedPreferences = context
        .getSharedPreferences("UserSettings", Context.MODE_PRIVATE)

    var deviceId: String
        get() = prefs.getString(KEY_DEVICE_ID, null) ?: UUID.randomUUID().toString().also {
            // `also` block will execute only in case we return a new UUID.
            deviceId = it
        }
        set(it) {
            prefs
                .edit()
                .putString(KEY_DEVICE_ID, it)
                .apply()
        }

    companion object {
        // Depends on a taste / convention your team uses.
        // I like keeping my key constants within the companion object.
        private const val KEY_DEVICE_ID = "deviceId"
    }
}


For simplifying it even more, consider using Android KTX - it has some handy SharedPreferences extensions, described here: https://developer.android.com/kotlin/ktx