-
-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SPM install + Add secure #422
base: develop
Are you sure you want to change the base?
Changes from all commits
3e68be4
19df321
619f2b7
0d3928c
6eac860
e7314ee
5370f39
02156db
5ab5fd2
cf636f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,7 +149,8 @@ public struct From<O: DynamicObject> { | |
) | ||
throw CoreStoreError.unknown | ||
} | ||
fetchRequest.entity = parentStack.entityDescription(for: Internals.EntityIdentifier(self.entityClass))! | ||
guard let entity = parentStack.entityDescription(for: Internals.EntityIdentifier(self.entityClass)) else { return } | ||
fetchRequest.entity = entity | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What specific use-case does this resolve? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was facing an error when debugging, dunno if related to change of the store in a secure way, so I preferred to guard and avoid a strong crash |
||
guard applyAffectedStores else { | ||
|
||
return | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,12 +74,13 @@ public final class SQLiteStore: LocalStorage { | |
|
||
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was depending on CoreStore's default directories prior to 2.0.0, make sure to use the `SQLiteStore.legacy(...)` factory methods to create the `SQLiteStore` instead of using initializers directly. | ||
*/ | ||
public init() { | ||
public init(secure: Bool = false) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather implement this as a separate store, or a subclass of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can be good, I had tried a quick approach without too many changes, prob a subclass is even better |
||
|
||
self.fileURL = SQLiteStore.defaultFileURL | ||
self.configuration = nil | ||
self.migrationMappingProviders = [] | ||
self.localStorageOptions = nil | ||
self.secure = secure | ||
} | ||
|
||
/** | ||
|
@@ -133,7 +134,8 @@ public final class SQLiteStore: LocalStorage { | |
|
||
|
||
// MARK: StorageInterface | ||
|
||
private var secure: Bool = false | ||
|
||
/** | ||
The string identifier for the `NSPersistentStore`'s `type` property. For `SQLiteStore`s, this is always set to `NSSQLiteStoreType`. | ||
*/ | ||
|
@@ -217,6 +219,9 @@ public final class SQLiteStore: LocalStorage { | |
|
||
var storeOptions = self.storeOptions ?? [:] | ||
storeOptions[NSSQLitePragmasOption] = ["journal_mode": "DELETE"] | ||
if secure { | ||
storeOptions[NSPersistentStoreFileProtectionKey] = FileProtectionType.complete | ||
} | ||
try coordinator.addPersistentStore( | ||
ofType: Self.storeType, | ||
configurationName: self.configuration, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these exclusions needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was generating error on compiling if I didn't exclude that