Skip to content

Commit

Permalink
minor fix for store path when store url is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
Dilip Parmar committed May 21, 2020
1 parent bac0743 commit 642d156
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/CoreDataWrapper/CoreDataWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ final public class CoreDataWrapper {
case .sqlite: debugPrint("\(self.storeType)"); fallthrough
case .binary:
if let storeURL = self.storeURL {
storeDescription.url = storeURL
let dbFileNameWithExt = self.databaseFileName + self.storeType.getStoreFileExt()
storeDescription.url = storeURL.appendingPathComponent(dbFileNameWithExt)
} else {
storeDescription.url = self.storeFullURL
self.storeURL = self.storeFullURL
Expand Down Expand Up @@ -170,6 +171,7 @@ final public class CoreDataWrapper {
@available(iOS 12.0, macOS 10.13, *)
final public func saveMainContext(isSync: Bool,
completion: ((Bool) -> Void)?) {
debugPrint("called \(#function) at = \(Date())")
let saveChangesBlock = {
if self.mainContext.hasChanges {
do {
Expand All @@ -193,6 +195,7 @@ final public class CoreDataWrapper {
final public func saveBGContext(context: NSManagedObjectContext,
isSync: Bool,
completion: ((Bool) -> Void)?) {
debugPrint("called \(#function) at = \(Date())")
let saveChangesBlock = {
if context.hasChanges {
do {
Expand Down

0 comments on commit 642d156

Please # to comment.