Skip to content

Commit 6eeb1ea

Browse files
committed
Update readme
1 parent 135dbe5 commit 6eeb1ea

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ NSPredicate(format:"color = %@ and city = %@", argumentArray:["Blue", city])
6666

6767

6868

69-
70-
## `findOrCreate`
69+
## 'NSManagedObject' Extensions
70+
### `findOrCreate`
7171

7272
Finds an instance of the `NSManagedObject` that has a column (property) matching the passed value. If it doesn't exist in the database, creates one, and returns it.
7373

@@ -88,7 +88,7 @@ let d = Drawing.findOrCreate(id: "123", context: viewContext)
8888
*Tip: If you're using SwiftUI, adding a `String` column `id` plays nicely with `Identifiable`*
8989

9090

91-
## `findButDoNotCreate`
91+
### `findButDoNotCreate`
9292

9393
Same as `findOrCreate`, but returns `nil` if there is no object in the database.
9494

@@ -99,15 +99,15 @@ if let d = Drawing.findButDoNotCreate(id: "10001", context: viewContext) {
9999
}
100100
```
101101

102-
## `countFor`
102+
### `countFor`
103103

104104
Gets a count of objects matching the passed `Predicate`
105105

106106
```swift
107107
let count = Drawing.countFor(Predicate("someField = %@", true), context: viewContext)
108108
```
109109

110-
## `searchFor`
110+
### `searchFor`
111111

112112
Gets all objects matching the passed `Predicate`
113113

@@ -122,7 +122,7 @@ for drawing in results {
122122
```
123123

124124

125-
## `destroyAll`
125+
### `destroyAll`
126126

127127
Removes all objects from Core Data.
128128
*Deletes them from the context, and saves the context.*
@@ -230,5 +230,6 @@ struct ContentView: View {
230230
## Todo
231231
- [ ] Unit tests
232232
- [ ] Option to disable automatic saving when using `destroyAll`
233+
- [ ] Add docs on `NSPersistentContainer` agnosticity
233234
- [ ] Have an idea? Open an issue!
234235

0 commit comments

Comments
 (0)