Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Add back support for using multiple scratch contexts for writing oper…
Browse files Browse the repository at this point in the history
…ations
  • Loading branch information
albertodebortoli committed Jan 5, 2018
1 parent 0c760cc commit 7fdfa6c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
14 changes: 7 additions & 7 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
PODS:
- JustPersist/Core (1.1.0)
- JustPersist/MagicalRecord (1.1.0):
- JustPersist/Core (2.0.0)
- JustPersist/MagicalRecord (2.0.0):
- JustPersist/Core
- MagicalRecord (~> 2.3.2)
- JustPersist/Skopelos (1.1.0):
- JustPersist/Skopelos (2.0.0):
- JustPersist/Core
- Skopelos (~> 2.1.0)
- Skopelos (~> 2.2.0)
- MagicalRecord (2.3.2):
- MagicalRecord/Core (= 2.3.2)
- MagicalRecord/Core (2.3.2)
- Skopelos (2.1.0)
- Skopelos (2.2.0)

DEPENDENCIES:
- JustPersist/MagicalRecord (from `../`)
Expand All @@ -20,9 +20,9 @@ EXTERNAL SOURCES:
:path: ../

SPEC CHECKSUMS:
JustPersist: 3990e2114fef7c4487db8b7c8fc92531b807eb08
JustPersist: 1bf92f3ee0b556af1d6e319182415ed8ee7f06b5
MagicalRecord: 53bed74b4323b930992a725be713e53b37d19755
Skopelos: 27608e9ed6e880d6a33c1cbd569cf3ed1c6c8f06
Skopelos: ec662f64235d2ff2589d9c23719b93fdbbbdbe64

PODFILE CHECKSUM: b99881e9785c7f31dda9fd2f24bc7c8a01141fce

Expand Down
2 changes: 1 addition & 1 deletion JustPersist.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ At it's core, JustPersist is a persistence layer with a clear and simple interfa

s.subspec 'Skopelos' do |ss|
ss.dependency 'JustPersist/Core'
ss.dependency 'Skopelos', '~> 2.1.0'
ss.dependency 'Skopelos', '~> 2.2.0'
ss.source_files = 'JustPersist/Classes/Wrappers/Skopelos/*'
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
extension DataStoreUsing where Self: UIViewController {

func passDataStore(alongSegue segue: UIStoryboardSegue) {
guard var dataStoreRecipiant = segue.destination as? DataStoreUsing else { return }
guard let dataStoreRecipiant = segue.destination as? DataStoreUsing else { return }
dataStoreRecipiant.dataStore = dataStore
}
}
11 changes: 7 additions & 4 deletions JustPersist/Classes/Wrappers/Skopelos/SkopelosDataStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,23 @@ open class SkopelosDataStore: NSObject {
fileprivate var modelURL: URL
fileprivate var securityApplicationGroupIdentifier: String?
fileprivate var storeType: StoreType
fileprivate var allowsConcurrentWritings: Bool
fileprivate var isSetup = false
open var errorHandler: DataStoreErrorHandler?

public init(sqliteStack modelURL: URL, securityApplicationGroupIdentifier: String?, errorHandler: DataStoreErrorHandler? = nil) {
public init(sqliteStack modelURL: URL, securityApplicationGroupIdentifier: String?, allowsConcurrentWritings: Bool = true, errorHandler: DataStoreErrorHandler? = nil) {
storeType = .sqlite
self.modelURL = modelURL
self.securityApplicationGroupIdentifier = securityApplicationGroupIdentifier
self.allowsConcurrentWritings = allowsConcurrentWritings
self.errorHandler = errorHandler
super.init()
}

public init(inMemoryStack modelURL: URL, errorHandler: DataStoreErrorHandler? = nil) {
public init(inMemoryStack modelURL: URL, allowsConcurrentWritings: Bool = true, errorHandler: DataStoreErrorHandler? = nil) {
storeType = .inMemory
self.modelURL = modelURL
self.allowsConcurrentWritings = allowsConcurrentWritings
self.errorHandler = errorHandler
super.init()
}
Expand All @@ -59,9 +62,9 @@ extension SkopelosDataStore: DataStore {
guard !isSetup else { return }
switch storeType {
case .sqlite:
skopelos = SkopelosClient(sqliteStack: modelURL, securityApplicationGroupIdentifier: securityApplicationGroupIdentifier)
skopelos = SkopelosClient(sqliteStack: modelURL, securityApplicationGroupIdentifier: securityApplicationGroupIdentifier, allowsConcurrentWritings: allowsConcurrentWritings)
case .inMemory:
skopelos = SkopelosClient(inMemoryStack: modelURL)
skopelos = SkopelosClient(inMemoryStack: modelURL, allowsConcurrentWritings: allowsConcurrentWritings)
}
skopelos.delegate = self
isSetup = true
Expand Down

0 comments on commit 7fdfa6c

Please sign in to comment.