Skip to content

Repository files navigation

KPreference ⚙️

Edit SharedPreferences as easy as possible!💥🔥

No need to interact with some preference wrappers or override a setters, simply declare the variables right in your repository or other classes!!!

The only thing to do is to implement the PreferenceHolder interface and override the SharedPreferences

classServiceRepository @Inject constructor(
overridevalpreferences:SharedPreferences/* override this */
) : PreferenceHolder { /* implement this interface */// all preferences will be saved to the `preferences` object val isFirstLaunch:Boolean by BooleanPreference(false) // false - default valueval userToken:String by StringPreference("default value")
//or even easier, without specifying the typeval someIntPreference by IntPreference(5)
}

Add library to your project.

dependencies {
...
implementation "com.mancj:kpreference:$latestVersion"
}

🤩🤩🤩

About

Super lightweight Android preference Kotlin library made easy ⚙️⚙️⚙️

Topics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages