Skip to content

Commit df37c74

Browse files
Adds model example in README
1 parent e3af743 commit df37c74

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
[ ![Download](https://api.bintray.com/packages/elementsinteractive/maven/ObjectStore/images/download.svg) ](https://bintray.com/elementsinteractive/maven/ObjectStore/_latestVersion)
22
# ObjectStore
3+
4+
[![kotlin](https://img.shields.io/badge/kotlin-1.3.31-blue.svg)]()
5+
36
###### Convenient interface for persisting objects.
47
``` groovy
58
implementation "nl.elements.objectstore:objectstore:+"
@@ -19,6 +22,19 @@ fun example(store: ObjectStore) {
1922
}
2023
```
2124

25+
#### Define a model
26+
27+
```kotlin
28+
class AppData : ObjectStoreModel(InMemoryStore()) {
29+
var username by stringItem()
30+
var age by intItem()
31+
var hasSeenOnboarding by booleanItem()
32+
var lastSeen by longItem()
33+
var rating by floatItem()
34+
}
35+
```
36+
37+
2238
## Observing
2339
Each `ObjectStore` is (Rx) observable and will emit whenever something changes in store.
2440

0 commit comments

Comments
 (0)