Skip to content

Commit 5f4d5c7

Browse files
Adds model example in README
1 parent f957dea commit 5f4d5c7

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# ObjectStore
2+
3+
[![kotlin](https://img.shields.io/badge/kotlin-1.3.31-blue.svg)]()
4+
25
###### Convenient interface for persisting objects.
36
- Customizable serialization
47
- Customizable encryption
@@ -15,6 +18,19 @@ fun example(store: ObjectStore) {
1518
}
1619
```
1720

21+
#### Define a model
22+
23+
```kotlin
24+
class AppData : ObjectStoreModel(InMemoryStore()) {
25+
var username by stringItem()
26+
var age by intItem()
27+
var hasSeenOnboarding by booleanItem()
28+
var lastSeen by longItem()
29+
var rating by floatItem()
30+
}
31+
```
32+
33+
1834
## Observing
1935
Each `ObjectStore` is (Rx) observable and will emit whenever something changes in store.
2036

@@ -46,4 +62,4 @@ fun conceal(context: Context) {
4662
transformer = ConcealTransformer(crypto)
4763
)
4864
}
49-
```
65+
```

0 commit comments

Comments
 (0)