You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -66,104 +66,6 @@ let encryptedStack = DATAStackmodelName:(modelName:"MyAppModel", key:"yourHashKe
66
66
let encryptedStack =DATAStack(modelName:"MyAppModel", key:"yourHashKey", bundle: NSBundle.mainBundle(), storeName: "CustomStoreName", containerURL: sharedURL)
67
67
```
68
68
69
-
## Main Thread NSManagedObjectContext
70
-
71
-
Getting access to the NSManagedObjectContext attached to the main thread is as simple as using the `mainContext` property.
72
-
73
-
```swift
74
-
self.encryptedStack.mainContext
75
-
```
76
-
77
-
or
78
-
79
-
```swift
80
-
self.encryptedStack.viewContext
81
-
```
82
-
83
-
## Background Thread NSManagedObjectContext
84
-
85
-
You can easily create a new background NSManagedObjectContext for data processing. This block is completely asynchronous and will be run on a background thread.
86
-
87
-
To be compatible with NSPersistentContainer you can also use `performBackgroundTask` instead of `performInNewBackgroundContext`.
88
-
89
-
**Swift**
90
-
```swift
91
-
funccreateUser() {
92
-
self.dataStack.performInNewBackgroundContext { backgroundContext in
93
-
let entity = NSEntityDescription.entityForName("User", inManagedObjectContext: backgroundContext)!
94
-
let object =NSManagedObject(entity: entity, insertIntoManagedObjectContext: backgroundContext)
When using Xcode's Objective-C autocompletion the `backgroundContext` parameter name doesn't get included. Make sure to add it.
116
-
117
-
## Clean up
118
-
119
-
Deleting the `.sqlite` file and resetting the state of your **DATAStack** is as simple as just calling `drop`.
120
-
121
-
**Swift**
122
-
```swift
123
-
tryself.dataStack.drop()
124
-
```
125
-
126
-
**Objective-C**
127
-
```objc
128
-
[self.dataStack forceDrop];
129
-
```
130
-
131
-
## Testing
132
-
133
-
**DATAStack** is optimized for unit testing and it runs synchronously in testing enviroments. **EncryptedDATAStack** maintains its compatibility with the only difference that the storage type used is SQLite.
134
-
135
-
You can create a stack that uses in memory store like this if your Core Data model is located in your app bundle:
136
-
137
-
**Swift**
138
-
```swift
139
-
let encryptedStack =EncryptedDATAStack(modelName: "MyAppModel", key:"yourHashKey", bundle: NSBundle.mainBundle())
Originally, if `DATAStack` has troubles creating your persistent coordinator because a migration wasn't properly handled it will destroy your data and create a new sqlite file. --This features has yet to be tested--
166
-
167
69
## Installation
168
70
169
71
Attention: A copy of DATAStack.swift is already included in this pod.
@@ -173,14 +75,7 @@ Attention: A copy of DATAStack.swift is already included in this pod.
173
75
```ruby
174
76
use_frameworks!
175
77
176
-
pod 'EncryptedDATAStack'
177
-
```
178
-
179
-
**EncryptedDATAStack** is also available through [Carthage](https://github.com/Carthage/Carthage). To install
180
-
it, simply add the following line to your Cartfile:
181
-
182
-
```ruby
183
-
github 'flipacholas/EncryptedDATAStack'
78
+
pod 'EncryptedDATAStack', :git => 'https://github.com/flipacholas/EncryptedDATAStack.git'
184
79
```
185
80
186
81
## Improvements
@@ -197,4 +92,4 @@ Elvis Nuñez, [@3lvis](https://twitter.com/3lvis) and Project iMAS, [project-ima
197
92
198
93
## License
199
94
200
-
**EncryptedDATAStack** like **DATAStack**is available under the MIT license. See the LICENSE file for more info.
95
+
**EncryptedDATAStack** like **DATAStack** is available under the MIT license. See the LICENSE file for more info.
0 commit comments