florent37 / Multiplatform Preferences
Licence: apache-2.0
Kotlin Multi Platform Preferences, for android an ios : SharedPreferences & NSUserDefault
Stars: ✭ 76
Projects that are alternatives of or similar to Multiplatform Preferences
Prefser
Wrapper for Android SharedPreferences with object serialization and RxJava Observables
Stars: ✭ 228 (+200%)
Mutual labels: preferences, sharedpreferences
Colorpreference
A custom preference item for easy implementation of a color picker in Android's preference screen.
Stars: ✭ 299 (+293.42%)
Mutual labels: preferences, sharedpreferences
PowerPreference
💾 A Powerful library to control and simplify the usage of shared preference in Android.
Stars: ✭ 95 (+25%)
Mutual labels: preferences, sharedpreferences
Binaryprefs
Rapidly fast and lightweight re-implementation of SharedPreferences which stores each preference in files separately, performs disk operations via NIO with memory mapped byte buffers and works IPC (between processes). Written from scratch.
Stars: ✭ 484 (+536.84%)
Mutual labels: preferences, sharedpreferences
Typedpreferences
Preference wrappers for primitive types for Android
Stars: ✭ 191 (+151.32%)
Mutual labels: preferences, sharedpreferences
Multiplatform-LiveData
Multiplatorm implementation of LiveDatas / MVVM in kotlin android & native ios
Stars: ✭ 95 (+25%)
Mutual labels: native, multiplatform
Bulldog
Android library to simplify reading and writing to SharedPreferences, never write code like this anymore prefs.edit().putString("someKey","someString").apply()
Stars: ✭ 133 (+75%)
Mutual labels: preferences, sharedpreferences
Hawk
✔️ Secure, simple key-value storage for Android
Stars: ✭ 3,827 (+4935.53%)
Mutual labels: preferences, sharedpreferences
Kissme
Kissme: Kotlin Secure Storage Multiplatform
Stars: ✭ 351 (+361.84%)
Mutual labels: preferences, multiplatform
Multiplatform-Log
Kotlin Multi Platform Logger, for android an ios : Logcat & print
Stars: ✭ 49 (-35.53%)
Mutual labels: native, multiplatform
Materialpreferences
A highly flexible set of lovely looking views that provides functionality of preferences.
Stars: ✭ 495 (+551.32%)
Mutual labels: preferences, sharedpreferences
Preferenceroom
🚚 Android processing library for managing SharedPreferences persistence efficiently and structurally.
Stars: ✭ 341 (+348.68%)
Mutual labels: preferences, sharedpreferences
Mvikotlin
Extendable MVI framework for Kotlin Multiplatform with powerful debugging tools (logging and time travel)
Stars: ✭ 483 (+535.53%)
Mutual labels: multiplatform, native
Klock
Multiplatform Date and time library for Kotlin
Stars: ✭ 569 (+648.68%)
Mutual labels: multiplatform, native
React Native Redux Firebase Todo
React Native Redux Firebase Todo
Stars: ✭ 59 (-22.37%)
Mutual labels: native
Avm Simple
avm-simple是avm.js语法及DeepEngine3.0的使用用例,它可以帮助您快速了解和学习avm.js、DeepEngine3.0以及多端技术的使用。
Stars: ✭ 66 (-13.16%)
Mutual labels: native
Mac config
Scripted installation and configuration of Mac OS X apps and preferences
Stars: ✭ 55 (-27.63%)
Mutual labels: preferences
Visualmasm
Visual MASM - Assembly IDE for Microsoft MASM
Stars: ✭ 1,172 (+1442.11%)
Mutual labels: native
Multiplatform Preferences
Use a single object : Preferences
in your kotlin shared projects
Compatible with kotlin android and kotlin native for iphone
class MyPresenter {
val preferences = Preferences()
fun start(){
preferences.getString("userName")?.let {
view.displayUser(it)
}
val age = preferences.getInt("age", 18)
view.displayUserAge(age)
}
}
Download
Add the repository
repositories {
maven { url "https://dl.bintray.com/florent37/maven" }
}
common
implementation "com.github.florent37:multiplatform-preferences:1.2.0"
ios
Uses inside the NSUserDefaults
implementation "com.github.florent37:multiplatform-preferences-ios:1.2.0"
android
Uses inside the SharedPreferences
implementation "com.github.florent37:multiplatform-preferences-android:1.2.0"
Methods
class Preferences(name: String? = null) {
fun setInt(key: String, value: Int)
fun getInt(key: String, defaultValue: Int): Int
fun getInt(key: String): Int?
fun setFloat(key: String, value: Float)
fun getFloat(key: String, defaultValue: Float): Float
fun getFloat(key: String): Float?
fun setLong(key: String, value: Long)
fun getLong(key: String, defaultValue: Long): Long
fun getLong(key: String): Long?
fun setString(key: String, value: String)
fun getString(key: String, defaultValue: String): String
fun getString(key: String): String?
fun setBoolean(key: String, value: Boolean)
fun getBoolean(key: String, defaultValue: Boolean): Boolean
fun getBoolean(key: String): Boolean?
fun remove(key: String)
fun clear()
fun hasKey(key: String): Boolean
}
License
Copyright 2018 Florent37
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].