Compare commits

..

9 Commits
5.1.1 ... 5.2.0

Author SHA1 Message Date
John Estropia
f25879b6fe fix compile error on tvOS and watchOS 2018-08-09 21:04:09 +09:00
John Estropia
8fa3109e91 version bump 2018-08-09 20:45:46 +09:00
John Estropia
808e8ff97a stabilize NSProgress when lightweight migration falls back to InferredMappingModel 2018-08-09 18:18:21 +09:00
John Estropia
30685d4355 Use InferredMappingModel in case lightweight migration fails for some reason 2018-08-09 02:09:54 +09:00
John Estropia
7152962026 revert 2018-08-09 01:39:16 +09:00
John Estropia
91735e38d1 Fix issue where CoreStoreObjects nested in a type is mismatching classnames before migration 2018-08-08 23:52:47 +09:00
John Estropia
333a50ad9e Merge pull request #256 from vGubriienko/demo-fix
Fixed issue with brightness observing in the Demo
2018-08-03 17:44:40 +09:00
John Rommel Estropia
b7a602fc67 iOS 11 Core Data changes 2018-07-29 23:33:51 +09:00
Viktor Gubriienko
2ff7ecef96 Fixed issue with brightness observing in the Demo 2018-06-12 17:53:00 +03:00
7 changed files with 38 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CoreStore"
s.version = "5.1.1"
s.version = "5.2.0"
s.swift_version = "4.1"
s.license = "MIT"
s.summary = "Unleashing the real power of Core Data with the elegance and safety of Swift"

View File

@@ -192,7 +192,7 @@ class ObjectObserverDemoViewController: UIViewController, ObjectObserver {
self.saturationSlider?.value = palette.saturation.value
}
if changedKeys == nil || changedKeys?.contains(String(keyPath: \Palette.hue)) == true {
if changedKeys == nil || changedKeys?.contains(String(keyPath: \Palette.brightness)) == true {
self.brightnessSlider?.value = palette.brightness.value
}

View File

@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>5.1.1</string>
<string>5.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@@ -708,9 +708,9 @@ public extension DataStack {
var fakeProgress: Float = 0
var recursiveCheck: () -> Void = {}
recursiveCheck = {
recursiveCheck = { [weak timerQueue] in
guard fakeProgress < 1 else {
guard let timerQueue = timerQueue, fakeProgress < 1 else {
return
}
@@ -739,13 +739,13 @@ public extension DataStack {
fakeProgress = 1
}
try storage.cs_finalizeStorageAndWait(soureModelHint: destinationModel)
_ = try? storage.cs_finalizeStorageAndWait(soureModelHint: destinationModel)
progress.completedUnitCount = progress.totalUnitCount
return
}
catch {
throw CoreStoreError(error)
// Lightweight migration failed somehow. Proceed using InferedMappingModel below
}
}
@@ -760,6 +760,11 @@ public extension DataStack {
attributes: nil
)
let externalStorageFolderName = ".\(fileURL.deletingPathExtension().lastPathComponent)_SUPPORT"
let temporaryExternalStorageURL = temporaryDirectoryURL.appendingPathComponent(
externalStorageFolderName,
isDirectory: true
)
let temporaryFileURL = temporaryDirectoryURL.appendingPathComponent(
fileURL.lastPathComponent,
isDirectory: false
@@ -796,25 +801,22 @@ public extension DataStack {
throw CoreStoreError(error)
}
let externalStorageDirName = "." + fileURL.deletingPathExtension().lastPathComponent + "_SUPPORT"
let temporaryExternalStorageURL = temporaryDirectoryURL.appendingPathComponent(
externalStorageDirName,
isDirectory: true
)
do {
try fileManager.replaceItem(
at: fileURL as URL,
at: fileURL,
withItemAt: temporaryFileURL,
backupItemName: nil,
options: [],
resultingItemURL: nil
)
if fileManager.fileExists(atPath: temporaryExternalStorageURL.path) {
let extenralStorageURL = fileURL.deletingLastPathComponent().appendingPathComponent(externalStorageDirName, isDirectory: true)
let externalStorageURL = fileURL
.deletingLastPathComponent()
.appendingPathComponent(externalStorageFolderName, isDirectory: true)
try fileManager.replaceItem(
at: extenralStorageURL as URL,
at: externalStorageURL,
withItemAt: temporaryExternalStorageURL,
backupItemName: nil,
options: [],

View File

@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.1.1</string>
<string>5.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@@ -42,7 +42,10 @@ internal final class MigrationManager: NSMigrationManager, ProgressReporting {
return
}
let progress = self.progress
progress.completedUnitCount = Int64(Float(progress.totalUnitCount) * self.migrationProgress)
progress.completedUnitCount = max(
progress.completedUnitCount,
Int64(Float(progress.totalUnitCount) * self.migrationProgress)
)
}

View File

@@ -150,7 +150,15 @@ public final class SQLiteStore: LocalStorage {
[NSSQLitePragmasOption: ["journal_mode": "WAL"]]
```
*/
public let storeOptions: [AnyHashable: Any]? = [NSSQLitePragmasOption: ["journal_mode": "WAL"]]
public let storeOptions: [AnyHashable: Any]? = autoreleasepool {
var storeOptions: [AnyHashable: Any] = [NSSQLitePragmasOption: ["journal_mode": "WAL"]]
if #available(iOS 11.0, OSX 10.13, tvOSApplicationExtension 11.0, watchOSApplicationExtension 4.0, *) {
storeOptions[NSBinaryStoreInsecureDecodingCompatibilityOption] = true
}
return storeOptions
}
/**
Do not call directly. Used by the `DataStack` internally.
@@ -212,11 +220,13 @@ public final class SQLiteStore: LocalStorage {
_ = try withExtendedLifetime(NSPersistentStoreCoordinator(managedObjectModel: soureModelHint)) { (coordinator: NSPersistentStoreCoordinator) in
var storeOptions = self.storeOptions ?? [:]
storeOptions[NSSQLitePragmasOption] = ["journal_mode": "DELETE"]
try coordinator.addPersistentStore(
ofType: type(of: self).storeType,
configurationName: self.configuration,
at: fileURL,
options: [NSSQLitePragmasOption: ["journal_mode": "DELETE"]]
options: storeOptions
)
}
_ = try? FileManager.default.removeItem(atPath: "\(self.fileURL.path)-shm")
@@ -276,11 +286,13 @@ public final class SQLiteStore: LocalStorage {
if let soureModel = soureModelHint ?? NSManagedObjectModel.mergedModel(from: nil, forStoreMetadata: metadata) {
let journalUpdatingCoordinator = NSPersistentStoreCoordinator(managedObjectModel: soureModel)
var storeOptions = self.storeOptions ?? [:]
storeOptions[NSSQLitePragmasOption] = ["journal_mode": "DELETE"]
let store = try journalUpdatingCoordinator.addPersistentStore(
ofType: type(of: self).storeType,
configurationName: self.configuration,
at: fileURL,
options: [NSSQLitePragmasOption: ["journal_mode": "DELETE"]]
options: storeOptions
)
try journalUpdatingCoordinator.remove(store)
}