Compare commits

...

50 Commits

Author SHA1 Message Date
John Rommel Estropia 6e88b14237 fixed readme build status 2016-02-20 12:30:02 +09:00
John Rommel Estropia 53700a267f version bump 2016-02-20 12:28:39 +09:00
John Rommel Estropia 6c95b010e9 utility to update an existing ImportableObject from its ImportSource (fixes #52) 2016-02-20 12:26:23 +09:00
John Rommel Estropia 1af675e8b7 tidy up 2016-02-20 12:05:01 +09:00
John Rommel Estropia b85f16cf68 Merge branch 'master' into develop 2016-02-20 01:25:40 +09:00
John Estropia 37bf4179c8 renamed "Incremental Migrations" to "Progressive Migrations" to match the common term used by the community 2016-02-17 15:34:33 +09:00
John Estropia 240dda6ad6 Merge pull request #50 from ReadmeCritic/master
Correct the spelling of Xcode in README
2016-02-17 10:03:47 +09:00
ReadmeCritic ffe73d0f66 Correct the spelling of Xcode in README 2016-02-16 11:47:36 -08:00
John Rommel Estropia 43c4998e20 fix podspec 2016-02-17 02:32:39 +09:00
John Rommel Estropia 0c4e55f061 Merge branch 'develop' 2016-02-17 02:06:57 +09:00
John Rommel Estropia 8c8953c507 updated .travis.yml 2016-02-17 01:57:28 +09:00
John Rommel Estropia 66892f22a3 comments cleanup 2016-02-17 01:38:26 +09:00
John Rommel Estropia def105e73a added utility to query transactions about pending inserts, updates, and deletes 2016-02-17 00:00:25 +09:00
John Rommel Estropia 57bf123fb2 assert missing classes in model 2016-02-16 07:52:34 +09:00
John Rommel Estropia 8efd6572f0 Refetch monitors when persistent stores are added/removed. Allow unsafe transactions to create their own monitors 2016-02-15 07:56:17 +09:00
John Estropia 405e861907 Merge pull request #47 from ReadmeCritic/master
Correct the spelling of CocoaPods in README
2016-02-12 10:37:49 +09:00
ReadmeCritic 74c48c7486 Correct the spelling of CocoaPods in README 2016-02-11 09:45:40 -08:00
John Rommel Estropia e58b3b0131 fixed some typos in the README 2016-02-11 09:25:32 +09:00
John Rommel Estropia b8fad66bfa tidy up: copyright symbol 2016-02-01 01:07:07 +09:00
John Rommel Estropia ff1155dac3 fix OSX compiler error 2016-01-31 23:27:29 +09:00
John Rommel Estropia 5137649b78 Fix for Swift 2.2 compatibility 2016-01-31 17:23:34 +09:00
John Rommel Estropia 7a95267a9c updated Readme 2016-01-26 12:34:06 +09:00
John Rommel Estropia c07435e866 Added utility for re-faulting all objects in a transaction/dataStack 2016-01-26 12:22:30 +09:00
John Rommel Estropia f5627f0855 fixed demo app framework settings 2016-01-23 01:52:27 +09:00
John Estropia d3ea655eb9 Merge branch 'master' into develop
Conflicts:
	README.md
2016-01-19 12:26:37 +09:00
John Estropia fc83180af8 updated README 2016-01-19 12:25:58 +09:00
John Estropia 0c6246475a update README 2016-01-19 12:24:14 +09:00
John Estropia 087480a3a8 update cartfile 2016-01-19 12:22:14 +09:00
John Estropia 83a04e669e updated .travis.yml 2016-01-19 11:55:22 +09:00
John Estropia d05522bb20 tidy up, set default directory to Caches folder on tvOS 2016-01-19 11:38:11 +09:00
Cihat Gündüz 9081b36cca Add tvOS target + Configure target + Add shared scheme for tvOS 2016-01-17 13:30:45 +01:00
Cihat Gündüz 9322371224 Use tvOS_support feature branch of GCDKit (Carthage + git submodules) 2016-01-17 13:11:58 +01:00
John Estropia 26ab6aacd7 exposed utility for extracting the parent transaction for objects created from UnsafeDataTransactions 2016-01-14 17:54:58 +09:00
John Estropia 3e601c1328 tidy up (WIP: queue check for NSManagedObjectContext property updates) 2016-01-08 20:44:42 +09:00
John Estropia 762b877879 Merge pull request #35 from JohnEstropia/modify-gitignore
Update .gitignore: Add .DS_Store
2016-01-08 18:41:29 +09:00
Hiroshi Kimura 084bdc431f Update .gitignore: Add .DS_Store 2016-01-08 18:40:16 +09:00
John Estropia c63bc389b2 updated travis.yml 2016-01-06 19:29:58 +09:00
John Estropia 71c3abc4f3 Let ListMonitor expose methods for Section Indexes (fixes #32) 2016-01-06 19:16:46 +09:00
John Estropia 863d4d1d5a Merge branch 'master' into develop
# Conflicts:
#	README.md
2016-01-06 18:45:45 +09:00
John Estropia 06d177e8bd Update README.md 2016-01-04 19:38:42 +09:00
John Estropia c2bbd537cf Update README.md 2016-01-04 19:38:11 +09:00
John Estropia 761d349b97 Rename CartFile to Cartfile. Sorry about that 2016-01-04 12:38:05 +09:00
John Rommel Estropia 6c28594e41 fixed shouldUpdateFromImportSource() not called from importUniqueObject() (fixes #31) 2015-12-29 08:25:06 +08:00
John Estropia c229af19a2 added GCDKit to Carthage installation guide 2015-12-18 19:28:02 +09:00
John Estropia 8b8a7c7b08 fix macOSX development target 2015-12-16 14:01:56 +09:00
John Estropia eb828d8e42 update deployment version 2015-12-15 21:20:56 +09:00
John Estropia 88a24540c6 remove IPHONEOS_DEPLOYMENT_TARGET flag 2015-12-15 20:51:48 +09:00
John Estropia 74ded8fb7d update .travis.yml 2015-12-15 19:58:59 +09:00
John Estropia 969f4cefb4 use workspaces for better carthage support 2015-12-15 19:56:07 +09:00
John Estropia 1d2947ad26 added Carthage dependency 2015-12-08 18:34:10 +09:00
102 changed files with 3504 additions and 2292 deletions
+4
View File
@@ -2,3 +2,7 @@ CoreStoreDemo/CoreStoreDemo.xcodeproj/project.xcworkspace/xcuserdata
CoreStore.xcodeproj/project.xcworkspace/xcuserdata CoreStore.xcodeproj/project.xcworkspace/xcuserdata
CoreStore.xcodeproj/xcuserdata CoreStore.xcodeproj/xcuserdata
CoreStoreDemo/CoreStoreDemo.xcodeproj/xcuserdata CoreStoreDemo/CoreStoreDemo.xcodeproj/xcuserdata
Carthage/Build
CoreStore.xcworkspace/xcuserdata
.DS_Store
DerivedData
+2 -2
View File
@@ -1,3 +1,3 @@
[submodule "Libraries/GCDKit"] [submodule "Carthage/Checkouts/GCDKit"]
path = Libraries/GCDKit path = Carthage/Checkouts/GCDKit
url = https://github.com/JohnEstropia/GCDKit.git url = https://github.com/JohnEstropia/GCDKit.git
+22 -12
View File
@@ -1,32 +1,42 @@
language: objective-c language: objective-c
osx_image: xcode7.1 osx_image: xcode7.2
sudo: false sudo: false
git:
submodules: false
notifications:
email: false
env: env:
global: global:
- LC_CTYPE=en_US.UTF-8 - LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8 - LANG=en_US.UTF-8
matrix: matrix:
- DESTINATION="OS=9.1,name=iPhone 6s" SCHEME="CoreStore iOS" SDK=iphonesimulator9.1 RUN_TESTS="YES" POD_LINT="NO" - DESTINATION="OS=9.2,name=iPhone 6s" SCHEME="CoreStore iOS" SDK=iphonesimulator9.2 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=9.0,name=iPhone 6 Plus" SCHEME="CoreStore iOS" SDK=iphonesimulator9.1 RUN_TESTS="YES" POD_LINT="NO" - DESTINATION="OS=9.0,name=iPhone 6 Plus" SCHEME="CoreStore iOS" SDK=iphonesimulator9.2 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=8.4,name=iPhone 6" SCHEME="CoreStore iOS" SDK=iphonesimulator9.1 RUN_TESTS="YES" POD_LINT="NO" - DESTINATION="OS=8.4,name=iPhone 6" SCHEME="CoreStore iOS" SDK=iphonesimulator9.2 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=8.3,name=iPhone 5S" SCHEME="CoreStore iOS" SDK=iphonesimulator9.1 RUN_TESTS="YES" POD_LINT="NO" - DESTINATION="OS=8.3,name=iPhone 5S" SCHEME="CoreStore iOS" SDK=iphonesimulator9.2 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=8.2,name=iPhone 5" SCHEME="CoreStore iOS" SDK=iphonesimulator9.1 RUN_TESTS="YES" POD_LINT="NO" - DESTINATION="OS=8.2,name=iPhone 5" SCHEME="CoreStore iOS" SDK=iphonesimulator9.2 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=8.1,name=iPhone 4S" SCHEME="CoreStore iOS" SDK=iphonesimulator9.1 RUN_TESTS="YES" POD_LINT="YES" - DESTINATION="OS=8.1,name=iPhone 4S" SCHEME="CoreStore iOS" SDK=iphonesimulator9.2 RUN_TESTS="YES" POD_LINT="YES"
- DESTINATION="arch=x86_64" SCHEME="CoreStore OSX" SDK=macosx10.11 RUN_TESTS="YES" POD_LINT="NO" - DESTINATION="arch=x86_64" SCHEME="CoreStore OSX" SDK=macosx10.11 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=2.0,name=Apple Watch - 42mm" SCHEME="CoreStore watchOS" SDK=watchsimulator2.0 RUN_TESTS="NO" POD_LINT="NO" - DESTINATION="OS=2.1,name=Apple Watch - 42mm" SCHEME="CoreStore watchOS" SDK=watchsimulator2.1 RUN_TESTS="NO" POD_LINT="NO"
- DESTINATION="OS=9.1,name=Apple TV 1080p" SCHEME="CoreStore tvOS" SDK=appletvsimulator9.1 RUN_TESTS="YES" POD_LINT="NO"
before_install: before_install:
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet - gem install cocoapods --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet - gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- curl -OlL "https://github.com/Carthage/Carthage/releases/download/0.11/Carthage.pkg"
- sudo installer -pkg "Carthage.pkg" -target /
- rm "Carthage.pkg"
before_script:
- carthage update --use-submodules
script: script:
- set -o pipefail - set -o pipefail
- xcodebuild -version - xcodebuild -version
- xcodebuild -showsdks - xcodebuild -showsdks
- if [ $RUN_TESTS == "YES" ]; then - if [ $RUN_TESTS == "YES" ]; then
xcodebuild -project CoreStore.xcodeproj -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO test | xcpretty -c; xcodebuild -workspace CoreStore.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
xcodebuild -project CoreStore.xcodeproj -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO test | xcpretty -c; xcodebuild -workspace CoreStore.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
fi fi
- xcodebuild -project "CoreStoreDemo/CoreStoreDemo.xcodeproj" -scheme "CoreStore iOS" -sdk "iphonesimulator9.1" -destination "OS=9.1,name=iPhone 6s" -configuration Debug ONLY_ACTIVE_ARCH=NO test | xcpretty -c; - xcodebuild -workspace "CoreStore.xcworkspace" -scheme "CoreStore iOS" -sdk "iphonesimulator9.2" -destination "OS=9.2,name=iPhone 6s" -configuration Debug ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
- xcodebuild -project "CoreStoreDemo/CoreStoreDemo.xcodeproj" -scheme "CoreStore iOS" -sdk "iphonesimulator9.1" -destination "OS=9.1,name=iPhone 6s" -configuration Release ONLY_ACTIVE_ARCH=NO test | xcpretty -c; - xcodebuild -workspace "CoreStore.xcworkspace" -scheme "CoreStore iOS" -sdk "iphonesimulator9.2" -destination "OS=9.2,name=iPhone 6s" -configuration Release ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
- if [ $POD_LINT == "YES" ]; then - if [ $POD_LINT == "YES" ]; then
pod lib lint --quick; pod lib lint --quick;
fi fi
+1
View File
@@ -0,0 +1 @@
github "JohnEstropia/GCDKit" == 1.1.7
+1
View File
@@ -0,0 +1 @@
github "JohnEstropia/GCDKit" "1.1.7"
Vendored Submodule
+1
+4 -3
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "CoreStore" s.name = "CoreStore"
s.version = "1.3.6" s.version = "1.5.1"
s.license = "MIT" s.license = "MIT"
s.summary = "Unleashing the real power of Core Data with the elegance and safety of Swift" s.summary = "Unleashing the real power of Core Data with the elegance and safety of Swift"
s.homepage = "https://github.com/JohnEstropia/CoreStore" s.homepage = "https://github.com/JohnEstropia/CoreStore"
@@ -10,12 +10,13 @@ Pod::Spec.new do |s|
s.ios.deployment_target = "8.0" s.ios.deployment_target = "8.0"
s.osx.deployment_target = "10.10" s.osx.deployment_target = "10.10"
s.watchos.deployment_target = "2.0" s.watchos.deployment_target = "2.0"
s.tvos.deployment_target = "9.0"
s.source_files = "CoreStore", "CoreStore/**/*.{swift}" s.source_files = "CoreStore", "CoreStore/**/*.{swift}"
s.osx.exclude_files = "CoreStore/Observing/*.{swift}", "CoreStore/Internal/FetchedResultsControllerDelegate.swift", "CoreStore/Convenience Helpers/NSFetchedResultsController+Convenience.swift" s.osx.exclude_files = "CoreStore/Observing/*.{swift}", "CoreStore/Internal/FetchedResultsControllerDelegate.swift", "CoreStore/Internal/CoreStoreFetchedResultsController.swift", "CoreStore/Convenience Helpers/NSFetchedResultsController+Convenience.swift"
s.frameworks = "Foundation", "CoreData" s.frameworks = "Foundation", "CoreData"
s.requires_arc = true s.requires_arc = true
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-D USE_FRAMEWORKS' } s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-D USE_FRAMEWORKS' }
s.dependency "GCDKit", "1.1.5" s.dependency "GCDKit", "1.1.7"
end end
+377 -177
View File
@@ -11,12 +11,83 @@
2F03A54019C5C6DA005002A5 /* CoreStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F03A53F19C5C6DA005002A5 /* CoreStoreTests.swift */; }; 2F03A54019C5C6DA005002A5 /* CoreStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F03A53F19C5C6DA005002A5 /* CoreStoreTests.swift */; };
2F03A54D19C5C872005002A5 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2F03A54C19C5C872005002A5 /* CoreData.framework */; }; 2F03A54D19C5C872005002A5 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2F03A54C19C5C872005002A5 /* CoreData.framework */; };
2F291E2719C6D3CF007AF63F /* CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F291E2619C6D3CF007AF63F /* CoreStore.swift */; }; 2F291E2719C6D3CF007AF63F /* CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F291E2619C6D3CF007AF63F /* CoreStore.swift */; };
82BA18931C4BBCBA00A0916E /* CoreStore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82BA18891C4BBCBA00A0916E /* CoreStore.framework */; };
82BA18A01C4BBD1400A0916E /* CoreStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F03A53519C5C6DA005002A5 /* CoreStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
82BA18A11C4BBD1D00A0916E /* CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F291E2619C6D3CF007AF63F /* CoreStore.swift */; };
82BA18A21C4BBD1D00A0916E /* NSError+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D1E22B19FA9FBC003B2874 /* NSError+CoreStore.swift */; };
82BA18A31C4BBD2200A0916E /* DataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EDB1AFF84500064E85B /* DataStack.swift */; };
82BA18A41C4BBD2200A0916E /* PersistentStoreResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EDE1AFF84500064E85B /* PersistentStoreResult.swift */; };
82BA18A51C4BBD2200A0916E /* CoreStore+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B504D0D51B02362500B2BBB1 /* CoreStore+Setup.swift */; };
82BA18A61C4BBD2900A0916E /* DefaultLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EE31AFF84610064E85B /* DefaultLogger.swift */; };
82BA18A71C4BBD2900A0916E /* CoreStore+Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EE41AFF84610064E85B /* CoreStore+Logging.swift */; };
82BA18A81C4BBD2900A0916E /* CoreStoreLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EE51AFF84610064E85B /* CoreStoreLogger.swift */; };
82BA18A91C4BBD3100A0916E /* Into.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56007101B3F6BD500A9A8F9 /* Into.swift */; };
82BA18AA1C4BBD3100A0916E /* BaseDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EEB1AFF846E0064E85B /* BaseDataTransaction.swift */; };
82BA18AB1C4BBD3100A0916E /* AsynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EEA1AFF846E0064E85B /* AsynchronousDataTransaction.swift */; };
82BA18AC1C4BBD3100A0916E /* SynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EF31AFF846E0064E85B /* SynchronousDataTransaction.swift */; };
82BA18AD1C4BBD3100A0916E /* UnsafeDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EED1AFF846E0064E85B /* UnsafeDataTransaction.swift */; };
82BA18AE1C4BBD3100A0916E /* DataStack+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EEC1AFF846E0064E85B /* DataStack+Transaction.swift */; };
82BA18AF1C4BBD3100A0916E /* CoreStore+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EEE1AFF846E0064E85B /* CoreStore+Transaction.swift */; };
82BA18B01C4BBD3100A0916E /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */; };
82BA18B11C4BBD3100A0916E /* SaveResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EF21AFF846E0064E85B /* SaveResult.swift */; };
82BA18B21C4BBD3900A0916E /* ImportableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F1DA8C1B9AA97D007C5CBB /* ImportableObject.swift */; };
82BA18B31C4BBD3900A0916E /* ImportableUniqueObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F1DA8F1B9AA991007C5CBB /* ImportableUniqueObject.swift */; };
82BA18B41C4BBD3900A0916E /* BaseDataTransaction+Importing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E834B81B76311F001D3D50 /* BaseDataTransaction+Importing.swift */; };
82BA18B51C4BBD3F00A0916E /* BaseDataTransaction+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EFE1AFF847B0064E85B /* BaseDataTransaction+Querying.swift */; };
82BA18B61C4BBD3F00A0916E /* DataStack+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F061AFF847B0064E85B /* DataStack+Querying.swift */; };
82BA18B71C4BBD3F00A0916E /* CoreStore+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F071AFF847B0064E85B /* CoreStore+Querying.swift */; };
82BA18B81C4BBD4200A0916E /* ClauseTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F401AFF8CCD0064E85B /* ClauseTypes.swift */; };
82BA18B91C4BBD4A00A0916E /* From.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F011AFF847B0064E85B /* From.swift */; };
82BA18BA1C4BBD4A00A0916E /* Select.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F031AFF847B0064E85B /* Select.swift */; };
82BA18BB1C4BBD4A00A0916E /* Where.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F051AFF847B0064E85B /* Where.swift */; };
82BA18BC1C4BBD4A00A0916E /* OrderBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F041AFF847B0064E85B /* OrderBy.swift */; };
82BA18BD1C4BBD4A00A0916E /* GroupBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F021AFF847B0064E85B /* GroupBy.swift */; };
82BA18BE1C4BBD4A00A0916E /* Tweak.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F001AFF847B0064E85B /* Tweak.swift */; };
82BA18BF1C4BBD5300A0916E /* SectionBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56007131B3F6C2800A9A8F9 /* SectionBy.swift */; };
82BA18C01C4BBD5300A0916E /* DataStack+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1A1AFF84860064E85B /* DataStack+Observing.swift */; };
82BA18C11C4BBD5300A0916E /* CoreStore+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1B1AFF84860064E85B /* CoreStore+Observing.swift */; };
82BA18C21C4BBD5300A0916E /* ObjectMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1C1AFF84860064E85B /* ObjectMonitor.swift */; };
82BA18C31C4BBD5300A0916E /* ObjectObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1F1AFF84860064E85B /* ObjectObserver.swift */; };
82BA18C41C4BBD5300A0916E /* ListMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1D1AFF84860064E85B /* ListMonitor.swift */; };
82BA18C51C4BBD5300A0916E /* ListObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1E1AFF84860064E85B /* ListObserver.swift */; };
82BA18C61C4BBD5900A0916E /* DataStack+Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56964D31B22FFAD0075EE4A /* DataStack+Migration.swift */; };
82BA18C71C4BBD5900A0916E /* CoreStore+Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FAD6AD1B518DCB00714891 /* CoreStore+Migration.swift */; };
82BA18C81C4BBD5900A0916E /* MigrationChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56007151B4018AB00A9A8F9 /* MigrationChain.swift */; };
82BA18C91C4BBD5900A0916E /* MigrationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A261201B64BFDB006EB6D3 /* MigrationType.swift */; };
82BA18CA1C4BBD5900A0916E /* MigrationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56965231B356B820075EE4A /* MigrationResult.swift */; };
82BA18CB1C4BBD6400A0916E /* NSManagedObject+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F271AFF84920064E85B /* NSManagedObject+Convenience.swift */; };
82BA18CC1C4BBD6400A0916E /* NSProgress+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FAD6A81B50A4B300714891 /* NSProgress+Convenience.swift */; };
82BA18CD1C4BBD7100A0916E /* AssociatedObjects.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2A1AFF849C0064E85B /* AssociatedObjects.swift */; };
82BA18CE1C4BBD7100A0916E /* FetchedResultsControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54A6A541BA15F2A007870FD /* FetchedResultsControllerDelegate.swift */; };
82BA18CF1C4BBD7100A0916E /* Functions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E834BA1B7691F3001D3D50 /* Functions.swift */; };
82BA18D01C4BBD7100A0916E /* MigrationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FAD6AB1B51285300714891 /* MigrationManager.swift */; };
82BA18D11C4BBD7100A0916E /* NotificationObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2B1AFF849C0064E85B /* NotificationObserver.swift */; };
82BA18D21C4BBD7100A0916E /* NSFileManager+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59D5C211B5BA34B00453479 /* NSFileManager+Setup.swift */; };
82BA18D31C4BBD7100A0916E /* NSManagedObjectContext+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2C1AFF849C0064E85B /* NSManagedObjectContext+CoreStore.swift */; };
82BA18D41C4BBD7100A0916E /* NSManagedObjectContext+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */; };
82BA18D51C4BBD7100A0916E /* NSManagedObjectContext+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */; };
82BA18D61C4BBD7100A0916E /* NSManagedObjectContext+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F331AFF85470064E85B /* NSManagedObjectContext+Transaction.swift */; };
82BA18D71C4BBD7100A0916E /* NSManagedObjectModel+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */; };
82BA18D81C4BBD7100A0916E /* WeakObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2D1AFF849C0064E85B /* WeakObject.swift */; };
82BA18D91C4BBD9700A0916E /* CoreStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F03A53F19C5C6DA005002A5 /* CoreStoreTests.swift */; };
82BA18DA1C4BBD9700A0916E /* TestEntity1.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D372851A39CDDB00F583D9 /* TestEntity1.swift */; };
82BA18DB1C4BBD9700A0916E /* TestEntity2.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D5E0CE1A4D6AAB006468AF /* TestEntity2.swift */; };
82BA18DC1C4BBD9C00A0916E /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = B5D372821A39CD6900F583D9 /* Model.xcdatamodeld */; };
82BA18DD1C4BBE1400A0916E /* NSFetchedResultsController+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */; };
82BA18DF1C4BBE2600A0916E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82BA18DE1C4BBE2600A0916E /* Foundation.framework */; };
82BA18E11C4BBE2C00A0916E /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82BA18E01C4BBE2C00A0916E /* CoreData.framework */; };
B50392F91C478FF3009900CA /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */; };
B50392FA1C47963F009900CA /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */; };
B50392FB1C479640009900CA /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */; };
B504D0D61B02362500B2BBB1 /* CoreStore+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B504D0D51B02362500B2BBB1 /* CoreStore+Setup.swift */; }; B504D0D61B02362500B2BBB1 /* CoreStore+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B504D0D51B02362500B2BBB1 /* CoreStore+Setup.swift */; };
B519E4581C4CD2CA00E7B469 /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B519E4571C4CD2CA00E7B469 /* GCDKit.framework */; };
B519E4591C4CD2D100E7B469 /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B519E4571C4CD2CA00E7B469 /* GCDKit.framework */; };
B519E45A1C4CD2DA00E7B469 /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B519E4571C4CD2CA00E7B469 /* GCDKit.framework */; };
B519E45B1C4CD2ED00E7B469 /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B519E4571C4CD2CA00E7B469 /* GCDKit.framework */; };
B51BE06A1B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */; }; B51BE06A1B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */; };
B5202CFA1C04688100DED140 /* NSFetchedResultsController+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */; }; B5202CFA1C04688100DED140 /* NSFetchedResultsController+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */; };
B5202CFD1C046E8400DED140 /* NSFetchedResultsController+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */; }; B5202CFD1C046E8400DED140 /* NSFetchedResultsController+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */; };
B52DD17E1BE1F8CD00949AFE /* CoreStore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B52DD1741BE1F8CC00949AFE /* CoreStore.framework */; }; B52DD17E1BE1F8CD00949AFE /* CoreStore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B52DD1741BE1F8CC00949AFE /* CoreStore.framework */; };
B52DD1901BE1F8E600949AFE /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5D808021A34715700A44484 /* GCDKit.framework */; };
B52DD1911BE1F8EB00949AFE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5548CD51BD65AE00077652A /* Foundation.framework */; }; B52DD1911BE1F8EB00949AFE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5548CD51BD65AE00077652A /* Foundation.framework */; };
B52DD1921BE1F8F000949AFE /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5548CD71BD65AE50077652A /* CoreData.framework */; }; B52DD1921BE1F8F000949AFE /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5548CD71BD65AE50077652A /* CoreData.framework */; };
B52DD1931BE1F8FD00949AFE /* CoreStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F03A53519C5C6DA005002A5 /* CoreStore.h */; settings = {ATTRIBUTES = (Public, ); }; }; B52DD1931BE1F8FD00949AFE /* CoreStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F03A53519C5C6DA005002A5 /* CoreStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -61,7 +132,6 @@
B52DD1C21BE1F94600949AFE /* MigrationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FAD6AB1B51285300714891 /* MigrationManager.swift */; }; B52DD1C21BE1F94600949AFE /* MigrationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FAD6AB1B51285300714891 /* MigrationManager.swift */; };
B52DD1C31BE1F94600949AFE /* NotificationObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2B1AFF849C0064E85B /* NotificationObserver.swift */; }; B52DD1C31BE1F94600949AFE /* NotificationObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2B1AFF849C0064E85B /* NotificationObserver.swift */; };
B52DD1C41BE1F94600949AFE /* NSFileManager+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59D5C211B5BA34B00453479 /* NSFileManager+Setup.swift */; }; B52DD1C41BE1F94600949AFE /* NSFileManager+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59D5C211B5BA34B00453479 /* NSFileManager+Setup.swift */; };
B52DD1C51BE1F94600949AFE /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F341AFF85470064E85B /* NSManagedObject+Transaction.swift */; };
B52DD1C61BE1F94600949AFE /* NSManagedObjectContext+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2C1AFF849C0064E85B /* NSManagedObjectContext+CoreStore.swift */; }; B52DD1C61BE1F94600949AFE /* NSManagedObjectContext+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2C1AFF849C0064E85B /* NSManagedObjectContext+CoreStore.swift */; };
B52DD1C71BE1F94600949AFE /* NSManagedObjectContext+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */; }; B52DD1C71BE1F94600949AFE /* NSManagedObjectContext+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */; };
B52DD1C81BE1F94600949AFE /* NSManagedObjectContext+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */; }; B52DD1C81BE1F94600949AFE /* NSManagedObjectContext+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */; };
@@ -78,7 +148,6 @@
B56007161B4018AB00A9A8F9 /* MigrationChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56007151B4018AB00A9A8F9 /* MigrationChain.swift */; }; B56007161B4018AB00A9A8F9 /* MigrationChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56007151B4018AB00A9A8F9 /* MigrationChain.swift */; };
B563217A1BD650DE006C9394 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B56321791BD650DE006C9394 /* CoreData.framework */; }; B563217A1BD650DE006C9394 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B56321791BD650DE006C9394 /* CoreData.framework */; };
B563217C1BD650E3006C9394 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B563217B1BD650E3006C9394 /* Foundation.framework */; }; B563217C1BD650E3006C9394 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B563217B1BD650E3006C9394 /* Foundation.framework */; };
B563217D1BD650FA006C9394 /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B56321691BD64F99006C9394 /* GCDKit.framework */; };
B563217E1BD65110006C9394 /* CoreStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F03A53519C5C6DA005002A5 /* CoreStore.h */; settings = {ATTRIBUTES = (Public, ); }; }; B563217E1BD65110006C9394 /* CoreStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F03A53519C5C6DA005002A5 /* CoreStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
B563217F1BD65216006C9394 /* CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F291E2619C6D3CF007AF63F /* CoreStore.swift */; }; B563217F1BD65216006C9394 /* CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F291E2619C6D3CF007AF63F /* CoreStore.swift */; };
B56321801BD65216006C9394 /* NSError+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D1E22B19FA9FBC003B2874 /* NSError+CoreStore.swift */; }; B56321801BD65216006C9394 /* NSError+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D1E22B19FA9FBC003B2874 /* NSError+CoreStore.swift */; };
@@ -129,7 +198,6 @@
B56321AD1BD6521C006C9394 /* MigrationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FAD6AB1B51285300714891 /* MigrationManager.swift */; }; B56321AD1BD6521C006C9394 /* MigrationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FAD6AB1B51285300714891 /* MigrationManager.swift */; };
B56321AE1BD6521C006C9394 /* NotificationObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2B1AFF849C0064E85B /* NotificationObserver.swift */; }; B56321AE1BD6521C006C9394 /* NotificationObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2B1AFF849C0064E85B /* NotificationObserver.swift */; };
B56321AF1BD6521C006C9394 /* NSFileManager+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59D5C211B5BA34B00453479 /* NSFileManager+Setup.swift */; }; B56321AF1BD6521C006C9394 /* NSFileManager+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59D5C211B5BA34B00453479 /* NSFileManager+Setup.swift */; };
B56321B01BD6521C006C9394 /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F341AFF85470064E85B /* NSManagedObject+Transaction.swift */; };
B56321B11BD6521C006C9394 /* NSManagedObjectContext+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2C1AFF849C0064E85B /* NSManagedObjectContext+CoreStore.swift */; }; B56321B11BD6521C006C9394 /* NSManagedObjectContext+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2C1AFF849C0064E85B /* NSManagedObjectContext+CoreStore.swift */; };
B56321B21BD6521C006C9394 /* NSManagedObjectContext+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */; }; B56321B21BD6521C006C9394 /* NSManagedObjectContext+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */; };
B56321B31BD6521C006C9394 /* NSManagedObjectContext+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */; }; B56321B31BD6521C006C9394 /* NSManagedObjectContext+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */; };
@@ -140,12 +208,17 @@
B56965241B356B820075EE4A /* MigrationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56965231B356B820075EE4A /* MigrationResult.swift */; }; B56965241B356B820075EE4A /* MigrationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56965231B356B820075EE4A /* MigrationResult.swift */; };
B59D5C221B5BA34B00453479 /* NSFileManager+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59D5C211B5BA34B00453479 /* NSFileManager+Setup.swift */; }; B59D5C221B5BA34B00453479 /* NSFileManager+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59D5C211B5BA34B00453479 /* NSFileManager+Setup.swift */; };
B5A261211B64BFDB006EB6D3 /* MigrationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A261201B64BFDB006EB6D3 /* MigrationType.swift */; }; B5A261211B64BFDB006EB6D3 /* MigrationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A261201B64BFDB006EB6D3 /* MigrationType.swift */; };
B5C976E31C6C9F6A00B1AF90 /* UnsafeDataTransaction+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C976E21C6C9F6A00B1AF90 /* UnsafeDataTransaction+Observing.swift */; };
B5C976E41C6C9F9A00B1AF90 /* UnsafeDataTransaction+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C976E21C6C9F6A00B1AF90 /* UnsafeDataTransaction+Observing.swift */; };
B5C976E51C6C9F9B00B1AF90 /* UnsafeDataTransaction+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C976E21C6C9F6A00B1AF90 /* UnsafeDataTransaction+Observing.swift */; };
B5C976E71C6E3A5A00B1AF90 /* CoreStoreFetchedResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C976E61C6E3A5900B1AF90 /* CoreStoreFetchedResultsController.swift */; };
B5C976E81C6E3A5D00B1AF90 /* CoreStoreFetchedResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C976E61C6E3A5900B1AF90 /* CoreStoreFetchedResultsController.swift */; };
B5C976E91C6E3A5E00B1AF90 /* CoreStoreFetchedResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C976E61C6E3A5900B1AF90 /* CoreStoreFetchedResultsController.swift */; };
B5D1E22C19FA9FBC003B2874 /* NSError+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D1E22B19FA9FBC003B2874 /* NSError+CoreStore.swift */; }; B5D1E22C19FA9FBC003B2874 /* NSError+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D1E22B19FA9FBC003B2874 /* NSError+CoreStore.swift */; };
B5D372841A39CD6900F583D9 /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = B5D372821A39CD6900F583D9 /* Model.xcdatamodeld */; }; B5D372841A39CD6900F583D9 /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = B5D372821A39CD6900F583D9 /* Model.xcdatamodeld */; };
B5D372861A39CDDB00F583D9 /* TestEntity1.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D372851A39CDDB00F583D9 /* TestEntity1.swift */; }; B5D372861A39CDDB00F583D9 /* TestEntity1.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D372851A39CDDB00F583D9 /* TestEntity1.swift */; };
B5D39A0219FD00C9000E91BB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5D39A0119FD00C9000E91BB /* Foundation.framework */; }; B5D39A0219FD00C9000E91BB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5D39A0119FD00C9000E91BB /* Foundation.framework */; };
B5D5E0CF1A4D6AAB006468AF /* TestEntity2.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D5E0CE1A4D6AAB006468AF /* TestEntity2.swift */; }; B5D5E0CF1A4D6AAB006468AF /* TestEntity2.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D5E0CE1A4D6AAB006468AF /* TestEntity2.swift */; };
B5D8080E1A3471A500A44484 /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5D808021A34715700A44484 /* GCDKit.framework */; };
B5E834B91B76311F001D3D50 /* BaseDataTransaction+Importing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E834B81B76311F001D3D50 /* BaseDataTransaction+Importing.swift */; }; B5E834B91B76311F001D3D50 /* BaseDataTransaction+Importing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E834B81B76311F001D3D50 /* BaseDataTransaction+Importing.swift */; };
B5E834BB1B7691F3001D3D50 /* Functions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E834BA1B7691F3001D3D50 /* Functions.swift */; }; B5E834BB1B7691F3001D3D50 /* Functions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E834BA1B7691F3001D3D50 /* Functions.swift */; };
B5E84EDF1AFF84500064E85B /* DataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EDB1AFF84500064E85B /* DataStack.swift */; }; B5E84EDF1AFF84500064E85B /* DataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EDB1AFF84500064E85B /* DataStack.swift */; };
@@ -182,7 +255,6 @@
B5E84F311AFF849C0064E85B /* WeakObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2D1AFF849C0064E85B /* WeakObject.swift */; }; B5E84F311AFF849C0064E85B /* WeakObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2D1AFF849C0064E85B /* WeakObject.swift */; };
B5E84F361AFF85470064E85B /* NSManagedObjectContext+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */; }; B5E84F361AFF85470064E85B /* NSManagedObjectContext+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */; };
B5E84F371AFF85470064E85B /* NSManagedObjectContext+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F331AFF85470064E85B /* NSManagedObjectContext+Transaction.swift */; }; B5E84F371AFF85470064E85B /* NSManagedObjectContext+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F331AFF85470064E85B /* NSManagedObjectContext+Transaction.swift */; };
B5E84F381AFF85470064E85B /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F341AFF85470064E85B /* NSManagedObject+Transaction.swift */; };
B5E84F391AFF85470064E85B /* NSManagedObjectContext+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */; }; B5E84F391AFF85470064E85B /* NSManagedObjectContext+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */; };
B5E84F411AFF8CCD0064E85B /* ClauseTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F401AFF8CCD0064E85B /* ClauseTypes.swift */; }; B5E84F411AFF8CCD0064E85B /* ClauseTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F401AFF8CCD0064E85B /* ClauseTypes.swift */; };
B5F1DA8D1B9AA97D007C5CBB /* ImportableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F1DA8C1B9AA97D007C5CBB /* ImportableObject.swift */; }; B5F1DA8D1B9AA97D007C5CBB /* ImportableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F1DA8C1B9AA97D007C5CBB /* ImportableObject.swift */; };
@@ -193,6 +265,13 @@
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
82BA18941C4BBCBA00A0916E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2F03A52719C5C6DA005002A5 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 82BA18881C4BBCBA00A0916E;
remoteInfo = "CoreStore tvOS";
};
B52DD17F1BE1F8CD00949AFE /* PBXContainerItemProxy */ = { B52DD17F1BE1F8CD00949AFE /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 2F03A52719C5C6DA005002A5 /* Project object */; containerPortal = 2F03A52719C5C6DA005002A5 /* Project object */;
@@ -200,41 +279,6 @@
remoteGlobalIDString = B52DD1731BE1F8CC00949AFE; remoteGlobalIDString = B52DD1731BE1F8CC00949AFE;
remoteInfo = "CoreStore OSX"; remoteInfo = "CoreStore OSX";
}; };
B52DD18E1BE1F8DC00949AFE /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B5D806C51A34715700A44484 /* GCDKit.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = B563212A1BD6359A006C9394;
remoteInfo = "GCDKit OSX";
};
B56321641BD64F99006C9394 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B5D806C51A34715700A44484 /* GCDKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = B563212B1BD6359A006C9394;
remoteInfo = "GCDKit OSX";
};
B56321661BD64F99006C9394 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B5D806C51A34715700A44484 /* GCDKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = B56321401BD63D14006C9394;
remoteInfo = "GCDKitTests OSX";
};
B56321681BD64F99006C9394 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B5D806C51A34715700A44484 /* GCDKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = B56321501BD6408F006C9394;
remoteInfo = "GCDKit watchOS";
};
B56321771BD650A3006C9394 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B5D806C51A34715700A44484 /* GCDKit.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = B563214F1BD6408F006C9394;
remoteInfo = "GCDKit watchOS";
};
B5D372871A39CF4D00F583D9 /* PBXContainerItemProxy */ = { B5D372871A39CF4D00F583D9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 2F03A52719C5C6DA005002A5 /* Project object */; containerPortal = 2F03A52719C5C6DA005002A5 /* Project object */;
@@ -242,27 +286,6 @@
remoteGlobalIDString = 2F03A52F19C5C6DA005002A5; remoteGlobalIDString = 2F03A52F19C5C6DA005002A5;
remoteInfo = CoreStore; remoteInfo = CoreStore;
}; };
B5D808011A34715700A44484 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B5D806C51A34715700A44484 /* GCDKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 2FBBCACB19A9FE610070E4AB;
remoteInfo = GCDKit;
};
B5D808031A34715700A44484 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B5D806C51A34715700A44484 /* GCDKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 2FBBCAD619A9FE610070E4AB;
remoteInfo = GCDKitTests;
};
B5D9C9081B20A87D00E64F0E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B5D806C51A34715700A44484 /* GCDKit.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 2FBBCACA19A9FE610070E4AB;
remoteInfo = GCDKit;
};
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
@@ -274,7 +297,13 @@
2F03A53F19C5C6DA005002A5 /* CoreStoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CoreStoreTests.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 2F03A53F19C5C6DA005002A5 /* CoreStoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CoreStoreTests.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
2F03A54C19C5C872005002A5 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 2F03A54C19C5C872005002A5 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
2F291E2619C6D3CF007AF63F /* CoreStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CoreStore.swift; sourceTree = "<group>"; }; 2F291E2619C6D3CF007AF63F /* CoreStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CoreStore.swift; sourceTree = "<group>"; };
82BA18891C4BBCBA00A0916E /* CoreStore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreStore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
82BA18921C4BBCBA00A0916E /* CoreStoreTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CoreStoreTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
82BA18DE1C4BBE2600A0916E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.1.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
82BA18E01C4BBE2C00A0916E /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.1.sdk/System/Library/Frameworks/CoreData.framework; sourceTree = DEVELOPER_DIR; };
B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObject+Transaction.swift"; sourceTree = "<group>"; };
B504D0D51B02362500B2BBB1 /* CoreStore+Setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CoreStore+Setup.swift"; sourceTree = "<group>"; }; B504D0D51B02362500B2BBB1 /* CoreStore+Setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CoreStore+Setup.swift"; sourceTree = "<group>"; };
B519E4571C4CD2CA00E7B469 /* GCDKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GCDKit.framework; path = "../../Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/GCDKit.framework"; sourceTree = "<group>"; };
B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectModel+Setup.swift"; sourceTree = "<group>"; }; B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectModel+Setup.swift"; sourceTree = "<group>"; };
B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSFetchedResultsController+Convenience.swift"; sourceTree = "<group>"; }; B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSFetchedResultsController+Convenience.swift"; sourceTree = "<group>"; };
B52DD1741BE1F8CC00949AFE /* CoreStore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreStore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; B52DD1741BE1F8CC00949AFE /* CoreStore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreStore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -292,12 +321,15 @@
B56965231B356B820075EE4A /* MigrationResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MigrationResult.swift; sourceTree = "<group>"; }; B56965231B356B820075EE4A /* MigrationResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MigrationResult.swift; sourceTree = "<group>"; };
B59D5C211B5BA34B00453479 /* NSFileManager+Setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSFileManager+Setup.swift"; sourceTree = "<group>"; }; B59D5C211B5BA34B00453479 /* NSFileManager+Setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSFileManager+Setup.swift"; sourceTree = "<group>"; };
B5A261201B64BFDB006EB6D3 /* MigrationType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MigrationType.swift; sourceTree = "<group>"; }; B5A261201B64BFDB006EB6D3 /* MigrationType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MigrationType.swift; sourceTree = "<group>"; };
B5BDC91A1C202269008147CD /* CartFile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CartFile; sourceTree = "<group>"; };
B5BDC9271C2024F2008147CD /* .travis.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .travis.yml; sourceTree = SOURCE_ROOT; };
B5C976E21C6C9F6A00B1AF90 /* UnsafeDataTransaction+Observing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UnsafeDataTransaction+Observing.swift"; sourceTree = "<group>"; };
B5C976E61C6E3A5900B1AF90 /* CoreStoreFetchedResultsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreStoreFetchedResultsController.swift; sourceTree = "<group>"; };
B5D1E22B19FA9FBC003B2874 /* NSError+CoreStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSError+CoreStore.swift"; sourceTree = "<group>"; }; B5D1E22B19FA9FBC003B2874 /* NSError+CoreStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSError+CoreStore.swift"; sourceTree = "<group>"; };
B5D372831A39CD6900F583D9 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; }; B5D372831A39CD6900F583D9 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; };
B5D372851A39CDDB00F583D9 /* TestEntity1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestEntity1.swift; sourceTree = "<group>"; }; B5D372851A39CDDB00F583D9 /* TestEntity1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestEntity1.swift; sourceTree = "<group>"; };
B5D39A0119FD00C9000E91BB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; B5D39A0119FD00C9000E91BB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
B5D5E0CE1A4D6AAB006468AF /* TestEntity2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestEntity2.swift; sourceTree = "<group>"; }; B5D5E0CE1A4D6AAB006468AF /* TestEntity2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestEntity2.swift; sourceTree = "<group>"; };
B5D806C51A34715700A44484 /* GCDKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = GCDKit.xcodeproj; sourceTree = "<group>"; };
B5D9C8F61B160ED200E64F0E /* CoreStore.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = CoreStore.podspec; sourceTree = SOURCE_ROOT; }; B5D9C8F61B160ED200E64F0E /* CoreStore.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = CoreStore.podspec; sourceTree = SOURCE_ROOT; };
B5E834B81B76311F001D3D50 /* BaseDataTransaction+Importing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "BaseDataTransaction+Importing.swift"; sourceTree = "<group>"; }; B5E834B81B76311F001D3D50 /* BaseDataTransaction+Importing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "BaseDataTransaction+Importing.swift"; sourceTree = "<group>"; };
B5E834BA1B7691F3001D3D50 /* Functions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Functions.swift; sourceTree = "<group>"; }; B5E834BA1B7691F3001D3D50 /* Functions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Functions.swift; sourceTree = "<group>"; };
@@ -337,7 +369,6 @@
B5E84F2D1AFF849C0064E85B /* WeakObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WeakObject.swift; sourceTree = "<group>"; }; B5E84F2D1AFF849C0064E85B /* WeakObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WeakObject.swift; sourceTree = "<group>"; };
B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Setup.swift"; sourceTree = "<group>"; }; B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Setup.swift"; sourceTree = "<group>"; };
B5E84F331AFF85470064E85B /* NSManagedObjectContext+Transaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Transaction.swift"; sourceTree = "<group>"; }; B5E84F331AFF85470064E85B /* NSManagedObjectContext+Transaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Transaction.swift"; sourceTree = "<group>"; };
B5E84F341AFF85470064E85B /* NSManagedObject+Transaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObject+Transaction.swift"; sourceTree = "<group>"; };
B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Querying.swift"; sourceTree = "<group>"; }; B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Querying.swift"; sourceTree = "<group>"; };
B5E84F401AFF8CCD0064E85B /* ClauseTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClauseTypes.swift; sourceTree = "<group>"; }; B5E84F401AFF8CCD0064E85B /* ClauseTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClauseTypes.swift; sourceTree = "<group>"; };
B5F1DA8C1B9AA97D007C5CBB /* ImportableObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImportableObject.swift; sourceTree = "<group>"; }; B5F1DA8C1B9AA97D007C5CBB /* ImportableObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImportableObject.swift; sourceTree = "<group>"; };
@@ -352,7 +383,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
B5D8080E1A3471A500A44484 /* GCDKit.framework in Frameworks */, B519E4581C4CD2CA00E7B469 /* GCDKit.framework in Frameworks */,
B5D39A0219FD00C9000E91BB /* Foundation.framework in Frameworks */, B5D39A0219FD00C9000E91BB /* Foundation.framework in Frameworks */,
2F03A54D19C5C872005002A5 /* CoreData.framework in Frameworks */, 2F03A54D19C5C872005002A5 /* CoreData.framework in Frameworks */,
); );
@@ -365,13 +396,31 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
82BA18851C4BBCBA00A0916E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B519E4591C4CD2D100E7B469 /* GCDKit.framework in Frameworks */,
82BA18E11C4BBE2C00A0916E /* CoreData.framework in Frameworks */,
82BA18DF1C4BBE2600A0916E /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
82BA188F1C4BBCBA00A0916E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
82BA18931C4BBCBA00A0916E /* CoreStore.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B52DD1701BE1F8CC00949AFE /* Frameworks */ = { B52DD1701BE1F8CC00949AFE /* Frameworks */ = {
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
B519E45A1C4CD2DA00E7B469 /* GCDKit.framework in Frameworks */,
B52DD1921BE1F8F000949AFE /* CoreData.framework in Frameworks */, B52DD1921BE1F8F000949AFE /* CoreData.framework in Frameworks */,
B52DD1911BE1F8EB00949AFE /* Foundation.framework in Frameworks */, B52DD1911BE1F8EB00949AFE /* Foundation.framework in Frameworks */,
B52DD1901BE1F8E600949AFE /* GCDKit.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -387,7 +436,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
B563217D1BD650FA006C9394 /* GCDKit.framework in Frameworks */, B519E45B1C4CD2ED00E7B469 /* GCDKit.framework in Frameworks */,
B563217C1BD650E3006C9394 /* Foundation.framework in Frameworks */, B563217C1BD650E3006C9394 /* Foundation.framework in Frameworks */,
B563217A1BD650DE006C9394 /* CoreData.framework in Frameworks */, B563217A1BD650DE006C9394 /* CoreData.framework in Frameworks */,
); );
@@ -399,7 +448,6 @@
2F03A52619C5C6DA005002A5 = { 2F03A52619C5C6DA005002A5 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
B5D806BB1A34715700A44484 /* Libraries */,
2F291E3119C6D4D3007AF63F /* Frameworks */, 2F291E3119C6D4D3007AF63F /* Frameworks */,
2F03A53219C5C6DA005002A5 /* CoreStore */, 2F03A53219C5C6DA005002A5 /* CoreStore */,
2F03A53C19C5C6DA005002A5 /* CoreStoreTests */, 2F03A53C19C5C6DA005002A5 /* CoreStoreTests */,
@@ -415,6 +463,8 @@
B563216F1BD65082006C9394 /* CoreStore.framework */, B563216F1BD65082006C9394 /* CoreStore.framework */,
B52DD1741BE1F8CC00949AFE /* CoreStore.framework */, B52DD1741BE1F8CC00949AFE /* CoreStore.framework */,
B52DD17D1BE1F8CC00949AFE /* CoreStoreTests.xctest */, B52DD17D1BE1F8CC00949AFE /* CoreStoreTests.xctest */,
82BA18891C4BBCBA00A0916E /* CoreStore.framework */,
82BA18921C4BBCBA00A0916E /* CoreStoreTests.xctest */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -446,6 +496,8 @@
B5E84ED81AFF82360064E85B /* README.md */, B5E84ED81AFF82360064E85B /* README.md */,
B5E84ED91AFF82360064E85B /* LICENSE */, B5E84ED91AFF82360064E85B /* LICENSE */,
B5D9C8F61B160ED200E64F0E /* CoreStore.podspec */, B5D9C8F61B160ED200E64F0E /* CoreStore.podspec */,
B5BDC91A1C202269008147CD /* CartFile */,
B5BDC9271C2024F2008147CD /* .travis.yml */,
); );
name = "Supporting Files"; name = "Supporting Files";
sourceTree = "<group>"; sourceTree = "<group>";
@@ -473,11 +525,14 @@
2F291E3119C6D4D3007AF63F /* Frameworks */ = { 2F291E3119C6D4D3007AF63F /* Frameworks */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
B519E4571C4CD2CA00E7B469 /* GCDKit.framework */,
B5548CD71BD65AE50077652A /* CoreData.framework */, B5548CD71BD65AE50077652A /* CoreData.framework */,
B56321791BD650DE006C9394 /* CoreData.framework */, B56321791BD650DE006C9394 /* CoreData.framework */,
82BA18E01C4BBE2C00A0916E /* CoreData.framework */,
2F03A54C19C5C872005002A5 /* CoreData.framework */, 2F03A54C19C5C872005002A5 /* CoreData.framework */,
B5548CD51BD65AE00077652A /* Foundation.framework */, B5548CD51BD65AE00077652A /* Foundation.framework */,
B563217B1BD650E3006C9394 /* Foundation.framework */, B563217B1BD650E3006C9394 /* Foundation.framework */,
82BA18DE1C4BBE2600A0916E /* Foundation.framework */,
B5D39A0119FD00C9000E91BB /* Foundation.framework */, B5D39A0119FD00C9000E91BB /* Foundation.framework */,
); );
name = Frameworks; name = Frameworks;
@@ -495,34 +550,6 @@
path = Migrating; path = Migrating;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
B5D806BB1A34715700A44484 /* Libraries */ = {
isa = PBXGroup;
children = (
B5D806BC1A34715700A44484 /* GCDKit */,
);
path = Libraries;
sourceTree = "<group>";
};
B5D806BC1A34715700A44484 /* GCDKit */ = {
isa = PBXGroup;
children = (
B5D806C51A34715700A44484 /* GCDKit.xcodeproj */,
);
path = GCDKit;
sourceTree = "<group>";
};
B5D806C61A34715700A44484 /* Products */ = {
isa = PBXGroup;
children = (
B5D808021A34715700A44484 /* GCDKit.framework */,
B5D808041A34715700A44484 /* GCDKitTests iOS.xctest */,
B56321651BD64F99006C9394 /* GCDKit.framework */,
B56321671BD64F99006C9394 /* GCDKitTests OSX.xctest */,
B56321691BD64F99006C9394 /* GCDKit.framework */,
);
name = Products;
sourceTree = "<group>";
};
B5E834B61B7630BD001D3D50 /* Importing Data */ = { B5E834B61B7630BD001D3D50 /* Importing Data */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@@ -563,6 +590,7 @@
B5E84EED1AFF846E0064E85B /* UnsafeDataTransaction.swift */, B5E84EED1AFF846E0064E85B /* UnsafeDataTransaction.swift */,
B5E84EEC1AFF846E0064E85B /* DataStack+Transaction.swift */, B5E84EEC1AFF846E0064E85B /* DataStack+Transaction.swift */,
B5E84EEE1AFF846E0064E85B /* CoreStore+Transaction.swift */, B5E84EEE1AFF846E0064E85B /* CoreStore+Transaction.swift */,
B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */,
B5E84EF21AFF846E0064E85B /* SaveResult.swift */, B5E84EF21AFF846E0064E85B /* SaveResult.swift */,
); );
path = "Saving and Processing"; path = "Saving and Processing";
@@ -607,6 +635,7 @@
B56007131B3F6C2800A9A8F9 /* SectionBy.swift */, B56007131B3F6C2800A9A8F9 /* SectionBy.swift */,
B5E84F1A1AFF84860064E85B /* DataStack+Observing.swift */, B5E84F1A1AFF84860064E85B /* DataStack+Observing.swift */,
B5E84F1B1AFF84860064E85B /* CoreStore+Observing.swift */, B5E84F1B1AFF84860064E85B /* CoreStore+Observing.swift */,
B5C976E21C6C9F6A00B1AF90 /* UnsafeDataTransaction+Observing.swift */,
B5E84F1C1AFF84860064E85B /* ObjectMonitor.swift */, B5E84F1C1AFF84860064E85B /* ObjectMonitor.swift */,
B5E84F1F1AFF84860064E85B /* ObjectObserver.swift */, B5E84F1F1AFF84860064E85B /* ObjectObserver.swift */,
B5E84F1D1AFF84860064E85B /* ListMonitor.swift */, B5E84F1D1AFF84860064E85B /* ListMonitor.swift */,
@@ -634,7 +663,7 @@
B5FAD6AB1B51285300714891 /* MigrationManager.swift */, B5FAD6AB1B51285300714891 /* MigrationManager.swift */,
B5E84F2B1AFF849C0064E85B /* NotificationObserver.swift */, B5E84F2B1AFF849C0064E85B /* NotificationObserver.swift */,
B59D5C211B5BA34B00453479 /* NSFileManager+Setup.swift */, B59D5C211B5BA34B00453479 /* NSFileManager+Setup.swift */,
B5E84F341AFF85470064E85B /* NSManagedObject+Transaction.swift */, B5C976E61C6E3A5900B1AF90 /* CoreStoreFetchedResultsController.swift */,
B5E84F2C1AFF849C0064E85B /* NSManagedObjectContext+CoreStore.swift */, B5E84F2C1AFF849C0064E85B /* NSManagedObjectContext+CoreStore.swift */,
B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */, B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */,
B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */, B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */,
@@ -656,6 +685,14 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
82BA18861C4BBCBA00A0916E /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
82BA18A01C4BBD1400A0916E /* CoreStore.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B52DD1711BE1F8CC00949AFE /* Headers */ = { B52DD1711BE1F8CC00949AFE /* Headers */ = {
isa = PBXHeadersBuildPhase; isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@@ -687,7 +724,6 @@
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
B5D9C9091B20A87D00E64F0E /* PBXTargetDependency */,
); );
name = "CoreStore iOS"; name = "CoreStore iOS";
productName = CoreStore; productName = CoreStore;
@@ -712,6 +748,42 @@
productReference = 2F03A53B19C5C6DA005002A5 /* CoreStoreTests.xctest */; productReference = 2F03A53B19C5C6DA005002A5 /* CoreStoreTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test"; productType = "com.apple.product-type.bundle.unit-test";
}; };
82BA18881C4BBCBA00A0916E /* CoreStore tvOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 82BA189E1C4BBCBA00A0916E /* Build configuration list for PBXNativeTarget "CoreStore tvOS" */;
buildPhases = (
82BA18841C4BBCBA00A0916E /* Sources */,
82BA18851C4BBCBA00A0916E /* Frameworks */,
82BA18861C4BBCBA00A0916E /* Headers */,
82BA18871C4BBCBA00A0916E /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "CoreStore tvOS";
productName = "CoreStore tvOS";
productReference = 82BA18891C4BBCBA00A0916E /* CoreStore.framework */;
productType = "com.apple.product-type.framework";
};
82BA18911C4BBCBA00A0916E /* CoreStoreTests tvOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 82BA189F1C4BBCBA00A0916E /* Build configuration list for PBXNativeTarget "CoreStoreTests tvOS" */;
buildPhases = (
82BA188E1C4BBCBA00A0916E /* Sources */,
82BA188F1C4BBCBA00A0916E /* Frameworks */,
82BA18901C4BBCBA00A0916E /* Resources */,
);
buildRules = (
);
dependencies = (
82BA18951C4BBCBA00A0916E /* PBXTargetDependency */,
);
name = "CoreStoreTests tvOS";
productName = "CoreStore tvOSTests";
productReference = 82BA18921C4BBCBA00A0916E /* CoreStoreTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
B52DD1731BE1F8CC00949AFE /* CoreStore OSX */ = { B52DD1731BE1F8CC00949AFE /* CoreStore OSX */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = B52DD18C1BE1F8CD00949AFE /* Build configuration list for PBXNativeTarget "CoreStore OSX" */; buildConfigurationList = B52DD18C1BE1F8CD00949AFE /* Build configuration list for PBXNativeTarget "CoreStore OSX" */;
@@ -724,7 +796,6 @@
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
B52DD18F1BE1F8DC00949AFE /* PBXTargetDependency */,
); );
name = "CoreStore OSX"; name = "CoreStore OSX";
productName = "CoreStore OSX"; productName = "CoreStore OSX";
@@ -761,7 +832,6 @@
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
B56321781BD650A3006C9394 /* PBXTargetDependency */,
); );
name = "CoreStore watchOS"; name = "CoreStore watchOS";
productName = "CoreStore watchOS"; productName = "CoreStore watchOS";
@@ -774,7 +844,7 @@
2F03A52719C5C6DA005002A5 /* Project object */ = { 2F03A52719C5C6DA005002A5 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 0710; LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0700; LastUpgradeCheck = 0700;
ORGANIZATIONNAME = "John Rommel Estropia"; ORGANIZATIONNAME = "John Rommel Estropia";
TargetAttributes = { TargetAttributes = {
@@ -784,6 +854,12 @@
2F03A53A19C5C6DA005002A5 = { 2F03A53A19C5C6DA005002A5 = {
CreatedOnToolsVersion = 6.0; CreatedOnToolsVersion = 6.0;
}; };
82BA18881C4BBCBA00A0916E = {
CreatedOnToolsVersion = 7.2;
};
82BA18911C4BBCBA00A0916E = {
CreatedOnToolsVersion = 7.2;
};
B52DD1731BE1F8CC00949AFE = { B52DD1731BE1F8CC00949AFE = {
CreatedOnToolsVersion = 7.1; CreatedOnToolsVersion = 7.1;
}; };
@@ -806,16 +882,12 @@
mainGroup = 2F03A52619C5C6DA005002A5; mainGroup = 2F03A52619C5C6DA005002A5;
productRefGroup = 2F03A53119C5C6DA005002A5 /* Products */; productRefGroup = 2F03A53119C5C6DA005002A5 /* Products */;
projectDirPath = ""; projectDirPath = "";
projectReferences = (
{
ProductGroup = B5D806C61A34715700A44484 /* Products */;
ProjectRef = B5D806C51A34715700A44484 /* GCDKit.xcodeproj */;
},
);
projectRoot = ""; projectRoot = "";
targets = ( targets = (
2F03A52F19C5C6DA005002A5 /* CoreStore iOS */, 2F03A52F19C5C6DA005002A5 /* CoreStore iOS */,
2F03A53A19C5C6DA005002A5 /* CoreStoreTests iOS */, 2F03A53A19C5C6DA005002A5 /* CoreStoreTests iOS */,
82BA18881C4BBCBA00A0916E /* CoreStore tvOS */,
82BA18911C4BBCBA00A0916E /* CoreStoreTests tvOS */,
B563216E1BD65082006C9394 /* CoreStore watchOS */, B563216E1BD65082006C9394 /* CoreStore watchOS */,
B52DD1731BE1F8CC00949AFE /* CoreStore OSX */, B52DD1731BE1F8CC00949AFE /* CoreStore OSX */,
B52DD17C1BE1F8CC00949AFE /* CoreStoreTests OSX */, B52DD17C1BE1F8CC00949AFE /* CoreStoreTests OSX */,
@@ -823,44 +895,6 @@
}; };
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXReferenceProxy section */
B56321651BD64F99006C9394 /* GCDKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GCDKit.framework;
remoteRef = B56321641BD64F99006C9394 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B56321671BD64F99006C9394 /* GCDKitTests OSX.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = "GCDKitTests OSX.xctest";
remoteRef = B56321661BD64F99006C9394 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B56321691BD64F99006C9394 /* GCDKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GCDKit.framework;
remoteRef = B56321681BD64F99006C9394 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B5D808021A34715700A44484 /* GCDKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GCDKit.framework;
remoteRef = B5D808011A34715700A44484 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B5D808041A34715700A44484 /* GCDKitTests iOS.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = "GCDKitTests iOS.xctest";
remoteRef = B5D808031A34715700A44484 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */ /* Begin PBXResourcesBuildPhase section */
2F03A52E19C5C6DA005002A5 /* Resources */ = { 2F03A52E19C5C6DA005002A5 /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
@@ -876,6 +910,20 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
82BA18871C4BBCBA00A0916E /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
82BA18901C4BBCBA00A0916E /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
B52DD1721BE1F8CC00949AFE /* Resources */ = { B52DD1721BE1F8CC00949AFE /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@@ -905,6 +953,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
B5E84F221AFF84860064E85B /* ObjectMonitor.swift in Sources */, B5E84F221AFF84860064E85B /* ObjectMonitor.swift in Sources */,
B5C976E71C6E3A5A00B1AF90 /* CoreStoreFetchedResultsController.swift in Sources */,
B5F1DA901B9AA991007C5CBB /* ImportableUniqueObject.swift in Sources */, B5F1DA901B9AA991007C5CBB /* ImportableUniqueObject.swift in Sources */,
B504D0D61B02362500B2BBB1 /* CoreStore+Setup.swift in Sources */, B504D0D61B02362500B2BBB1 /* CoreStore+Setup.swift in Sources */,
B5D1E22C19FA9FBC003B2874 /* NSError+CoreStore.swift in Sources */, B5D1E22C19FA9FBC003B2874 /* NSError+CoreStore.swift in Sources */,
@@ -914,6 +963,7 @@
B5E84F141AFF847B0064E85B /* DataStack+Querying.swift in Sources */, B5E84F141AFF847B0064E85B /* DataStack+Querying.swift in Sources */,
B56007141B3F6C2800A9A8F9 /* SectionBy.swift in Sources */, B56007141B3F6C2800A9A8F9 /* SectionBy.swift in Sources */,
B5E84F371AFF85470064E85B /* NSManagedObjectContext+Transaction.swift in Sources */, B5E84F371AFF85470064E85B /* NSManagedObjectContext+Transaction.swift in Sources */,
B5C976E31C6C9F6A00B1AF90 /* UnsafeDataTransaction+Observing.swift in Sources */,
B56007161B4018AB00A9A8F9 /* MigrationChain.swift in Sources */, B56007161B4018AB00A9A8F9 /* MigrationChain.swift in Sources */,
B5E84F0E1AFF847B0064E85B /* Tweak.swift in Sources */, B5E84F0E1AFF847B0064E85B /* Tweak.swift in Sources */,
B5E84F121AFF847B0064E85B /* OrderBy.swift in Sources */, B5E84F121AFF847B0064E85B /* OrderBy.swift in Sources */,
@@ -922,12 +972,12 @@
B5E84EE71AFF84610064E85B /* CoreStore+Logging.swift in Sources */, B5E84EE71AFF84610064E85B /* CoreStore+Logging.swift in Sources */,
B56007111B3F6BD500A9A8F9 /* Into.swift in Sources */, B56007111B3F6BD500A9A8F9 /* Into.swift in Sources */,
B5E84F111AFF847B0064E85B /* Select.swift in Sources */, B5E84F111AFF847B0064E85B /* Select.swift in Sources */,
B50392F91C478FF3009900CA /* NSManagedObject+Transaction.swift in Sources */,
B5202CFA1C04688100DED140 /* NSFetchedResultsController+Convenience.swift in Sources */, B5202CFA1C04688100DED140 /* NSFetchedResultsController+Convenience.swift in Sources */,
B5E84EE11AFF84500064E85B /* PersistentStoreResult.swift in Sources */, B5E84EE11AFF84500064E85B /* PersistentStoreResult.swift in Sources */,
B5E84F251AFF84860064E85B /* ObjectObserver.swift in Sources */, B5E84F251AFF84860064E85B /* ObjectObserver.swift in Sources */,
B5E84F2F1AFF849C0064E85B /* NotificationObserver.swift in Sources */, B5E84F2F1AFF849C0064E85B /* NotificationObserver.swift in Sources */,
B5F1DA8D1B9AA97D007C5CBB /* ImportableObject.swift in Sources */, B5F1DA8D1B9AA97D007C5CBB /* ImportableObject.swift in Sources */,
B5E84F381AFF85470064E85B /* NSManagedObject+Transaction.swift in Sources */,
B56965241B356B820075EE4A /* MigrationResult.swift in Sources */, B56965241B356B820075EE4A /* MigrationResult.swift in Sources */,
2F291E2719C6D3CF007AF63F /* CoreStore.swift in Sources */, 2F291E2719C6D3CF007AF63F /* CoreStore.swift in Sources */,
B5E84F411AFF8CCD0064E85B /* ClauseTypes.swift in Sources */, B5E84F411AFF8CCD0064E85B /* ClauseTypes.swift in Sources */,
@@ -975,6 +1025,83 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
82BA18841C4BBCBA00A0916E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
82BA18B61C4BBD3F00A0916E /* DataStack+Querying.swift in Sources */,
B5C976E81C6E3A5D00B1AF90 /* CoreStoreFetchedResultsController.swift in Sources */,
82BA18A21C4BBD1D00A0916E /* NSError+CoreStore.swift in Sources */,
82BA18B21C4BBD3900A0916E /* ImportableObject.swift in Sources */,
82BA18AE1C4BBD3100A0916E /* DataStack+Transaction.swift in Sources */,
82BA18AB1C4BBD3100A0916E /* AsynchronousDataTransaction.swift in Sources */,
82BA18CE1C4BBD7100A0916E /* FetchedResultsControllerDelegate.swift in Sources */,
82BA18C51C4BBD5300A0916E /* ListObserver.swift in Sources */,
82BA18C21C4BBD5300A0916E /* ObjectMonitor.swift in Sources */,
82BA18A51C4BBD2200A0916E /* CoreStore+Setup.swift in Sources */,
82BA18BD1C4BBD4A00A0916E /* GroupBy.swift in Sources */,
B5C976E41C6C9F9A00B1AF90 /* UnsafeDataTransaction+Observing.swift in Sources */,
82BA18B31C4BBD3900A0916E /* ImportableUniqueObject.swift in Sources */,
82BA18A11C4BBD1D00A0916E /* CoreStore.swift in Sources */,
82BA18CF1C4BBD7100A0916E /* Functions.swift in Sources */,
82BA18A31C4BBD2200A0916E /* DataStack.swift in Sources */,
82BA18C81C4BBD5900A0916E /* MigrationChain.swift in Sources */,
82BA18B11C4BBD3100A0916E /* SaveResult.swift in Sources */,
82BA18DD1C4BBE1400A0916E /* NSFetchedResultsController+Convenience.swift in Sources */,
82BA18B41C4BBD3900A0916E /* BaseDataTransaction+Importing.swift in Sources */,
82BA18CA1C4BBD5900A0916E /* MigrationResult.swift in Sources */,
82BA18C11C4BBD5300A0916E /* CoreStore+Observing.swift in Sources */,
82BA18BC1C4BBD4A00A0916E /* OrderBy.swift in Sources */,
82BA18B01C4BBD3100A0916E /* NSManagedObject+Transaction.swift in Sources */,
82BA18D41C4BBD7100A0916E /* NSManagedObjectContext+Querying.swift in Sources */,
82BA18D51C4BBD7100A0916E /* NSManagedObjectContext+Setup.swift in Sources */,
82BA18C91C4BBD5900A0916E /* MigrationType.swift in Sources */,
82BA18D01C4BBD7100A0916E /* MigrationManager.swift in Sources */,
82BA18C61C4BBD5900A0916E /* DataStack+Migration.swift in Sources */,
82BA18CD1C4BBD7100A0916E /* AssociatedObjects.swift in Sources */,
82BA18B71C4BBD3F00A0916E /* CoreStore+Querying.swift in Sources */,
82BA18A41C4BBD2200A0916E /* PersistentStoreResult.swift in Sources */,
82BA18AA1C4BBD3100A0916E /* BaseDataTransaction.swift in Sources */,
82BA18A91C4BBD3100A0916E /* Into.swift in Sources */,
82BA18D11C4BBD7100A0916E /* NotificationObserver.swift in Sources */,
82BA18BB1C4BBD4A00A0916E /* Where.swift in Sources */,
82BA18D71C4BBD7100A0916E /* NSManagedObjectModel+Setup.swift in Sources */,
82BA18C31C4BBD5300A0916E /* ObjectObserver.swift in Sources */,
82BA18D21C4BBD7100A0916E /* NSFileManager+Setup.swift in Sources */,
82BA18BF1C4BBD5300A0916E /* SectionBy.swift in Sources */,
82BA18AC1C4BBD3100A0916E /* SynchronousDataTransaction.swift in Sources */,
82BA18C71C4BBD5900A0916E /* CoreStore+Migration.swift in Sources */,
82BA18C41C4BBD5300A0916E /* ListMonitor.swift in Sources */,
82BA18BA1C4BBD4A00A0916E /* Select.swift in Sources */,
82BA18A71C4BBD2900A0916E /* CoreStore+Logging.swift in Sources */,
82BA18D81C4BBD7100A0916E /* WeakObject.swift in Sources */,
82BA18AF1C4BBD3100A0916E /* CoreStore+Transaction.swift in Sources */,
82BA18CB1C4BBD6400A0916E /* NSManagedObject+Convenience.swift in Sources */,
82BA18B51C4BBD3F00A0916E /* BaseDataTransaction+Querying.swift in Sources */,
82BA18D31C4BBD7100A0916E /* NSManagedObjectContext+CoreStore.swift in Sources */,
82BA18AD1C4BBD3100A0916E /* UnsafeDataTransaction.swift in Sources */,
82BA18A81C4BBD2900A0916E /* CoreStoreLogger.swift in Sources */,
82BA18B81C4BBD4200A0916E /* ClauseTypes.swift in Sources */,
82BA18D61C4BBD7100A0916E /* NSManagedObjectContext+Transaction.swift in Sources */,
82BA18B91C4BBD4A00A0916E /* From.swift in Sources */,
82BA18BE1C4BBD4A00A0916E /* Tweak.swift in Sources */,
82BA18CC1C4BBD6400A0916E /* NSProgress+Convenience.swift in Sources */,
82BA18C01C4BBD5300A0916E /* DataStack+Observing.swift in Sources */,
82BA18A61C4BBD2900A0916E /* DefaultLogger.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
82BA188E1C4BBCBA00A0916E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
82BA18DA1C4BBD9700A0916E /* TestEntity1.swift in Sources */,
82BA18DB1C4BBD9700A0916E /* TestEntity2.swift in Sources */,
82BA18D91C4BBD9700A0916E /* CoreStoreTests.swift in Sources */,
82BA18DC1C4BBD9C00A0916E /* Model.xcdatamodeld in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B52DD16F1BE1F8CC00949AFE /* Sources */ = { B52DD16F1BE1F8CC00949AFE /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@@ -1011,7 +1138,7 @@
B52DD1A41BE1F92F00949AFE /* ImportableObject.swift in Sources */, B52DD1A41BE1F92F00949AFE /* ImportableObject.swift in Sources */,
B52DD1AE1BE1F93900949AFE /* OrderBy.swift in Sources */, B52DD1AE1BE1F93900949AFE /* OrderBy.swift in Sources */,
B52DD1BA1BE1F94000949AFE /* MigrationChain.swift in Sources */, B52DD1BA1BE1F94000949AFE /* MigrationChain.swift in Sources */,
B52DD1C51BE1F94600949AFE /* NSManagedObject+Transaction.swift in Sources */, B50392FB1C479640009900CA /* NSManagedObject+Transaction.swift in Sources */,
B52DD1A31BE1F92C00949AFE /* SaveResult.swift in Sources */, B52DD1A31BE1F92C00949AFE /* SaveResult.swift in Sources */,
B52DD19F1BE1F92C00949AFE /* SynchronousDataTransaction.swift in Sources */, B52DD19F1BE1F92C00949AFE /* SynchronousDataTransaction.swift in Sources */,
B52DD1CB1BE1F94600949AFE /* WeakObject.swift in Sources */, B52DD1CB1BE1F94600949AFE /* WeakObject.swift in Sources */,
@@ -1046,6 +1173,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
B56321A91BD65219006C9394 /* NSProgress+Convenience.swift in Sources */, B56321A91BD65219006C9394 /* NSProgress+Convenience.swift in Sources */,
B5C976E91C6E3A5E00B1AF90 /* CoreStoreFetchedResultsController.swift in Sources */,
B56321801BD65216006C9394 /* NSError+CoreStore.swift in Sources */, B56321801BD65216006C9394 /* NSError+CoreStore.swift in Sources */,
B56321AD1BD6521C006C9394 /* MigrationManager.swift in Sources */, B56321AD1BD6521C006C9394 /* MigrationManager.swift in Sources */,
B563219D1BD65216006C9394 /* DataStack+Observing.swift in Sources */, B563219D1BD65216006C9394 /* DataStack+Observing.swift in Sources */,
@@ -1055,6 +1183,7 @@
B563219E1BD65216006C9394 /* CoreStore+Observing.swift in Sources */, B563219E1BD65216006C9394 /* CoreStore+Observing.swift in Sources */,
B56321891BD65216006C9394 /* AsynchronousDataTransaction.swift in Sources */, B56321891BD65216006C9394 /* AsynchronousDataTransaction.swift in Sources */,
B56321831BD65216006C9394 /* CoreStore+Setup.swift in Sources */, B56321831BD65216006C9394 /* CoreStore+Setup.swift in Sources */,
B5C976E51C6C9F9B00B1AF90 /* UnsafeDataTransaction+Observing.swift in Sources */,
B563217F1BD65216006C9394 /* CoreStore.swift in Sources */, B563217F1BD65216006C9394 /* CoreStore.swift in Sources */,
B56321911BD65216006C9394 /* BaseDataTransaction+Importing.swift in Sources */, B56321911BD65216006C9394 /* BaseDataTransaction+Importing.swift in Sources */,
B56321941BD65216006C9394 /* CoreStore+Querying.swift in Sources */, B56321941BD65216006C9394 /* CoreStore+Querying.swift in Sources */,
@@ -1063,6 +1192,7 @@
B56321981BD65216006C9394 /* Where.swift in Sources */, B56321981BD65216006C9394 /* Where.swift in Sources */,
B5202CFD1C046E8400DED140 /* NSFetchedResultsController+Convenience.swift in Sources */, B5202CFD1C046E8400DED140 /* NSFetchedResultsController+Convenience.swift in Sources */,
B56321AF1BD6521C006C9394 /* NSFileManager+Setup.swift in Sources */, B56321AF1BD6521C006C9394 /* NSFileManager+Setup.swift in Sources */,
B50392FA1C47963F009900CA /* NSManagedObject+Transaction.swift in Sources */,
B56321971BD65216006C9394 /* Select.swift in Sources */, B56321971BD65216006C9394 /* Select.swift in Sources */,
B56321AB1BD6521C006C9394 /* FetchedResultsControllerDelegate.swift in Sources */, B56321AB1BD6521C006C9394 /* FetchedResultsControllerDelegate.swift in Sources */,
B56321821BD65216006C9394 /* PersistentStoreResult.swift in Sources */, B56321821BD65216006C9394 /* PersistentStoreResult.swift in Sources */,
@@ -1083,7 +1213,6 @@
B563218F1BD65216006C9394 /* ImportableObject.swift in Sources */, B563218F1BD65216006C9394 /* ImportableObject.swift in Sources */,
B56321991BD65216006C9394 /* OrderBy.swift in Sources */, B56321991BD65216006C9394 /* OrderBy.swift in Sources */,
B56321A51BD65216006C9394 /* MigrationChain.swift in Sources */, B56321A51BD65216006C9394 /* MigrationChain.swift in Sources */,
B56321B01BD6521C006C9394 /* NSManagedObject+Transaction.swift in Sources */,
B563218E1BD65216006C9394 /* SaveResult.swift in Sources */, B563218E1BD65216006C9394 /* SaveResult.swift in Sources */,
B56321A21BD65216006C9394 /* ListObserver.swift in Sources */, B56321A21BD65216006C9394 /* ListObserver.swift in Sources */,
B563218A1BD65216006C9394 /* SynchronousDataTransaction.swift in Sources */, B563218A1BD65216006C9394 /* SynchronousDataTransaction.swift in Sources */,
@@ -1108,31 +1237,21 @@
/* End PBXSourcesBuildPhase section */ /* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */ /* Begin PBXTargetDependency section */
82BA18951C4BBCBA00A0916E /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 82BA18881C4BBCBA00A0916E /* CoreStore tvOS */;
targetProxy = 82BA18941C4BBCBA00A0916E /* PBXContainerItemProxy */;
};
B52DD1801BE1F8CD00949AFE /* PBXTargetDependency */ = { B52DD1801BE1F8CD00949AFE /* PBXTargetDependency */ = {
isa = PBXTargetDependency; isa = PBXTargetDependency;
target = B52DD1731BE1F8CC00949AFE /* CoreStore OSX */; target = B52DD1731BE1F8CC00949AFE /* CoreStore OSX */;
targetProxy = B52DD17F1BE1F8CD00949AFE /* PBXContainerItemProxy */; targetProxy = B52DD17F1BE1F8CD00949AFE /* PBXContainerItemProxy */;
}; };
B52DD18F1BE1F8DC00949AFE /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "GCDKit OSX";
targetProxy = B52DD18E1BE1F8DC00949AFE /* PBXContainerItemProxy */;
};
B56321781BD650A3006C9394 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "GCDKit watchOS";
targetProxy = B56321771BD650A3006C9394 /* PBXContainerItemProxy */;
};
B5D372881A39CF4D00F583D9 /* PBXTargetDependency */ = { B5D372881A39CF4D00F583D9 /* PBXTargetDependency */ = {
isa = PBXTargetDependency; isa = PBXTargetDependency;
target = 2F03A52F19C5C6DA005002A5 /* CoreStore iOS */; target = 2F03A52F19C5C6DA005002A5 /* CoreStore iOS */;
targetProxy = B5D372871A39CF4D00F583D9 /* PBXContainerItemProxy */; targetProxy = B5D372871A39CF4D00F583D9 /* PBXContainerItemProxy */;
}; };
B5D9C9091B20A87D00E64F0E /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GCDKit;
targetProxy = B5D9C9081B20A87D00E64F0E /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */ /* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
@@ -1172,15 +1291,18 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "-D USE_FRAMEWORKS -D DEBUG"; OTHER_SWIFT_FLAGS = "-D USE_FRAMEWORKS -D DEBUG";
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = ""; VERSION_INFO_PREFIX = "";
WATCHOS_DEPLOYMENT_TARGET = 2.0;
}; };
name = Debug; name = Debug;
}; };
@@ -1214,15 +1336,18 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
OTHER_SWIFT_FLAGS = "-D USE_FRAMEWORKS"; OTHER_SWIFT_FLAGS = "-D USE_FRAMEWORKS";
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
TVOS_DEPLOYMENT_TARGET = 9.0;
VALIDATE_PRODUCT = YES; VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = ""; VERSION_INFO_PREFIX = "";
WATCHOS_DEPLOYMENT_TARGET = 2.0;
}; };
name = Release; name = Release;
}; };
@@ -1236,10 +1361,10 @@
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = CoreStore/Info.plist; INFOPLIST_FILE = CoreStore/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.johnestropia.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "com.johnestropia.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = CoreStore; PRODUCT_NAME = CoreStore;
SDKROOT = iphoneos;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
}; };
name = Debug; name = Debug;
@@ -1254,10 +1379,10 @@
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = CoreStore/Info.plist; INFOPLIST_FILE = CoreStore/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.johnestropia.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "com.johnestropia.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = CoreStore; PRODUCT_NAME = CoreStore;
SDKROOT = iphoneos;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
}; };
name = Release; name = Release;
@@ -1266,7 +1391,6 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1", "DEBUG=1",
"$(inherited)", "$(inherited)",
@@ -1275,6 +1399,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.johnestropia.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "com.johnestropia.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = CoreStoreTests; PRODUCT_NAME = CoreStoreTests;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
}; };
name = Debug; name = Debug;
@@ -1283,11 +1408,76 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
INFOPLIST_FILE = CoreStoreTests/Info.plist; INFOPLIST_FILE = CoreStoreTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.johnestropia.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "com.johnestropia.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = CoreStoreTests; PRODUCT_NAME = CoreStoreTests;
SDKROOT = iphoneos;
};
name = Release;
};
82BA189A1C4BBCBA00A0916E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = CoreStore/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.johnestropia.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = CoreStore;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 3;
};
name = Debug;
};
82BA189B1C4BBCBA00A0916E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = CoreStore/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.johnestropia.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = CoreStore;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 3;
};
name = Release;
};
82BA189C1C4BBCBA00A0916E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = CoreStoreTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.johnestropia.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = CoreStoreTests;
SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3;
};
name = Debug;
};
82BA189D1C4BBCBA00A0916E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = CoreStoreTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.johnestropia.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = CoreStoreTests;
SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3;
}; };
name = Release; name = Release;
}; };
@@ -1307,7 +1497,6 @@
INFOPLIST_FILE = CoreStore/Info.plist; INFOPLIST_FILE = CoreStore/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore; PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore;
PRODUCT_NAME = CoreStore; PRODUCT_NAME = CoreStore;
SDKROOT = macosx; SDKROOT = macosx;
@@ -1332,7 +1521,6 @@
INFOPLIST_FILE = CoreStore/Info.plist; INFOPLIST_FILE = CoreStore/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore; PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore;
PRODUCT_NAME = CoreStore; PRODUCT_NAME = CoreStore;
SDKROOT = macosx; SDKROOT = macosx;
@@ -1350,7 +1538,6 @@
GCC_NO_COMMON_BLOCKS = YES; GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = CoreStore/Info.plist; INFOPLIST_FILE = CoreStore/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore; PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore;
PRODUCT_NAME = CoreStoreTests; PRODUCT_NAME = CoreStoreTests;
SDKROOT = macosx; SDKROOT = macosx;
@@ -1369,7 +1556,6 @@
GCC_NO_COMMON_BLOCKS = YES; GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = CoreStore/Info.plist; INFOPLIST_FILE = CoreStore/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore; PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore;
PRODUCT_NAME = CoreStoreTests; PRODUCT_NAME = CoreStoreTests;
SDKROOT = macosx; SDKROOT = macosx;
@@ -1387,14 +1573,12 @@
GCC_NO_COMMON_BLOCKS = YES; GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = CoreStore/Info.plist; INFOPLIST_FILE = CoreStore/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore; PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore;
PRODUCT_NAME = CoreStore; PRODUCT_NAME = CoreStore;
SDKROOT = watchos; SDKROOT = watchos;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 4; TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
}; };
name = Debug; name = Debug;
}; };
@@ -1410,14 +1594,12 @@
GCC_NO_COMMON_BLOCKS = YES; GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = CoreStore/Info.plist; INFOPLIST_FILE = CoreStore/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore; PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore;
PRODUCT_NAME = CoreStore; PRODUCT_NAME = CoreStore;
SDKROOT = watchos; SDKROOT = watchos;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 4; TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
}; };
name = Release; name = Release;
}; };
@@ -1451,6 +1633,24 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
82BA189E1C4BBCBA00A0916E /* Build configuration list for PBXNativeTarget "CoreStore tvOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
82BA189A1C4BBCBA00A0916E /* Debug */,
82BA189B1C4BBCBA00A0916E /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
82BA189F1C4BBCBA00A0916E /* Build configuration list for PBXNativeTarget "CoreStoreTests tvOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
82BA189C1C4BBCBA00A0916E /* Debug */,
82BA189D1C4BBCBA00A0916E /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
B52DD18C1BE1F8CD00949AFE /* Build configuration list for PBXNativeTarget "CoreStore OSX" */ = { B52DD18C1BE1F8CD00949AFE /* Build configuration list for PBXNativeTarget "CoreStore OSX" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "82BA18881C4BBCBA00A0916E"
BuildableName = "CoreStore.framework"
BlueprintName = "CoreStore tvOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "82BA18911C4BBCBA00A0916E"
BuildableName = "CoreStoreTests.xctest"
BlueprintName = "CoreStoreTests tvOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "82BA18881C4BBCBA00A0916E"
BuildableName = "CoreStore.framework"
BlueprintName = "CoreStore tvOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "82BA18881C4BBCBA00A0916E"
BuildableName = "CoreStore.framework"
BlueprintName = "CoreStore tvOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "82BA18881C4BBCBA00A0916E"
BuildableName = "CoreStore.framework"
BlueprintName = "CoreStore tvOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:CoreStore.xcodeproj">
</FileRef>
<FileRef
location = "group:CoreStoreDemo/CoreStoreDemo.xcodeproj">
</FileRef>
<FileRef
location = "group:Carthage/Checkouts/GCDKit/GCDKit.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,30 @@
{
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "4B60F1BCB491FF717C56441AE7783C74F417BE48",
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
},
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
"8B2E522D57154DFA93A06982C36315ECBEA4FA97" : 0,
"4B60F1BCB491FF717C56441AE7783C74F417BE48" : 0
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "EBFDEFFE-8BA0-441A-862A-1DE28AA5CD21",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"8B2E522D57154DFA93A06982C36315ECBEA4FA97" : "CoreStore\/Carthage\/Checkouts\/GCDKit\/",
"4B60F1BCB491FF717C56441AE7783C74F417BE48" : "CoreStore\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "CoreStore",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "CoreStore.xcworkspace",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/JohnEstropia\/CoreStore",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "4B60F1BCB491FF717C56441AE7783C74F417BE48"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/JohnEstropia\/GCDKit.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "8B2E522D57154DFA93A06982C36315ECBEA4FA97"
}
]
}
+1
View File
@@ -0,0 +1 @@
github "JohnEstropia/GCDKit" == 1.1.7
@@ -2,7 +2,7 @@
// NSManagedObject+Convenience.swift // NSManagedObject+Convenience.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -31,20 +31,31 @@ import CoreData
public extension NSFetchedResultsController { public extension NSFetchedResultsController {
public convenience init<T: NSManagedObject>(dataStack: DataStack, fetchRequest: NSFetchRequest, from: From<T>? = nil, sectionBy: SectionBy? = nil, fetchClauses: [FetchClause]) { /**
Utility for creating an `NSFetchedResultsController` from a `DataStack`. This is useful to partially support Objective-C classes by passing an `NSFetchedResultsController` instance instead of a `ListMonitor`.
*/
public func createForStack<T: NSManagedObject>(dataStack: DataStack, fetchRequest: NSFetchRequest, from: From<T>? = nil, sectionBy: SectionBy? = nil, fetchClauses: [FetchClause]) -> NSFetchedResultsController {
let context = dataStack.mainContext return CoreStoreFetchedResultsController<T>(
from?.applyToFetchRequest(fetchRequest, context: context) context: dataStack.mainContext,
for clause in fetchClauses { fetchRequest: fetchRequest,
from: from,
clause.applyToFetchRequest(fetchRequest) sectionBy: sectionBy,
fetchClauses: fetchClauses
)
} }
self.init(
// MARK: Internal
internal func createFromContext<T: NSManagedObject>(context: NSManagedObjectContext, fetchRequest: NSFetchRequest, from: From<T>? = nil, sectionBy: SectionBy? = nil, fetchClauses: [FetchClause]) -> NSFetchedResultsController {
return CoreStoreFetchedResultsController<T>(
context: context,
fetchRequest: fetchRequest, fetchRequest: fetchRequest,
managedObjectContext: context, from: from,
sectionNameKeyPath: sectionBy?.sectionKeyPath, sectionBy: sectionBy,
cacheName: nil fetchClauses: fetchClauses
) )
} }
} }
@@ -2,7 +2,7 @@
// NSManagedObject+Convenience.swift // NSManagedObject+Convenience.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,7 +2,7 @@
// NSProgress+Convenience.swift // NSProgress+Convenience.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -33,8 +33,6 @@ import Foundation
public extension NSProgress { public extension NSProgress {
// MARK: Public
/** /**
Sets a closure that the `NSProgress` calls whenever its `fractionCompleted` changes. You can use this instead of setting up KVO. Sets a closure that the `NSProgress` calls whenever its `fractionCompleted` changes. You can use this instead of setting up KVO.
- parameter closure: the closure to execute on progress change - parameter closure: the closure to execute on progress change
+1 -2
View File
@@ -2,7 +2,7 @@
// CoreStore.h // CoreStore.h
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -28,4 +28,3 @@
FOUNDATION_EXPORT double CoreStoreVersionNumber; FOUNDATION_EXPORT double CoreStoreVersionNumber;
FOUNDATION_EXPORT const unsigned char CoreStoreVersionString[]; FOUNDATION_EXPORT const unsigned char CoreStoreVersionString[];
+3 -5
View File
@@ -2,7 +2,7 @@
// CoreStore.swift // CoreStore.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -32,12 +32,10 @@ import CoreData
// MARK: - CoreStore // MARK: - CoreStore
/** /**
`CoreStore` is the main entry point for all other APIs. `CoreStore` is the main entry point for all other APIs.
*/ */
public enum CoreStore { public enum CoreStore {
// MARK: Public
/** /**
The default `DataStack` instance to be used. If `defaultStack` is not set before the first time accessed, a default-configured `DataStack` will be created. The default `DataStack` instance to be used. If `defaultStack` is not set before the first time accessed, a default-configured `DataStack` will be created.
@@ -2,7 +2,7 @@
// BaseDataTransaction+Querying.swift // BaseDataTransaction+Querying.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -31,8 +31,6 @@ import CoreData
public extension BaseDataTransaction { public extension BaseDataTransaction {
// MARK: Public
/** /**
Fetches the `NSManagedObject` instance in the transaction's context from a reference created from a transaction or from a different managed object context. Fetches the `NSManagedObject` instance in the transaction's context from a reference created from a transaction or from a different managed object context.
@@ -106,7 +104,7 @@ public extension BaseDataTransaction {
public func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> T? { public func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> T? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to fetch from a \(typeName(self)) outside its designated queue." "Attempted to fetch from a \(typeName(self)) outside its designated queue."
) )
@@ -124,7 +122,7 @@ public extension BaseDataTransaction {
public func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> T? { public func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> T? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to fetch from a \(typeName(self)) outside its designated queue." "Attempted to fetch from a \(typeName(self)) outside its designated queue."
) )
@@ -142,7 +140,7 @@ public extension BaseDataTransaction {
public func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [T]? { public func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [T]? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to fetch from a \(typeName(self)) outside its designated queue." "Attempted to fetch from a \(typeName(self)) outside its designated queue."
) )
@@ -160,7 +158,7 @@ public extension BaseDataTransaction {
public func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> [T]? { public func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> [T]? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to fetch from a \(typeName(self)) outside its designated queue." "Attempted to fetch from a \(typeName(self)) outside its designated queue."
) )
@@ -178,7 +176,7 @@ public extension BaseDataTransaction {
public func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> Int? { public func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> Int? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to fetch from a \(typeName(self)) outside its designated queue." "Attempted to fetch from a \(typeName(self)) outside its designated queue."
) )
@@ -196,7 +194,7 @@ public extension BaseDataTransaction {
public func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> Int? { public func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> Int? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to fetch from a \(typeName(self)) outside its designated queue." "Attempted to fetch from a \(typeName(self)) outside its designated queue."
) )
@@ -214,7 +212,7 @@ public extension BaseDataTransaction {
public func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> NSManagedObjectID? { public func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> NSManagedObjectID? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to fetch from a \(typeName(self)) outside its designated queue." "Attempted to fetch from a \(typeName(self)) outside its designated queue."
) )
@@ -232,7 +230,7 @@ public extension BaseDataTransaction {
public func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> NSManagedObjectID? { public func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> NSManagedObjectID? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to fetch from a \(typeName(self)) outside its designated queue." "Attempted to fetch from a \(typeName(self)) outside its designated queue."
) )
@@ -250,7 +248,7 @@ public extension BaseDataTransaction {
public func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [NSManagedObjectID]? { public func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [NSManagedObjectID]? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to fetch from a \(typeName(self)) outside its designated queue." "Attempted to fetch from a \(typeName(self)) outside its designated queue."
) )
@@ -268,7 +266,7 @@ public extension BaseDataTransaction {
public func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> [NSManagedObjectID]? { public func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> [NSManagedObjectID]? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to fetch from a \(typeName(self)) outside its designated queue." "Attempted to fetch from a \(typeName(self)) outside its designated queue."
) )
@@ -285,7 +283,7 @@ public extension BaseDataTransaction {
public func deleteAll<T: NSManagedObject>(from: From<T>, _ deleteClauses: DeleteClause...) -> Int? { public func deleteAll<T: NSManagedObject>(from: From<T>, _ deleteClauses: DeleteClause...) -> Int? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to delete from a \(typeName(self)) outside its designated queue." "Attempted to delete from a \(typeName(self)) outside its designated queue."
) )
@@ -302,7 +300,7 @@ public extension BaseDataTransaction {
public func deleteAll<T: NSManagedObject>(from: From<T>, _ deleteClauses: [DeleteClause]) -> Int? { public func deleteAll<T: NSManagedObject>(from: From<T>, _ deleteClauses: [DeleteClause]) -> Int? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to delete from a \(typeName(self)) outside its designated queue." "Attempted to delete from a \(typeName(self)) outside its designated queue."
) )
@@ -323,7 +321,7 @@ public extension BaseDataTransaction {
public func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: QueryClause...) -> U? { public func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: QueryClause...) -> U? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to query from a \(typeName(self)) outside its designated queue." "Attempted to query from a \(typeName(self)) outside its designated queue."
) )
@@ -344,7 +342,7 @@ public extension BaseDataTransaction {
public func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: [QueryClause]) -> U? { public func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: [QueryClause]) -> U? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to query from a \(typeName(self)) outside its designated queue." "Attempted to query from a \(typeName(self)) outside its designated queue."
) )
@@ -365,7 +363,7 @@ public extension BaseDataTransaction {
public func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: QueryClause...) -> [[NSString: AnyObject]]? { public func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: QueryClause...) -> [[NSString: AnyObject]]? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to query from a \(typeName(self)) outside its designated queue." "Attempted to query from a \(typeName(self)) outside its designated queue."
) )
@@ -386,7 +384,7 @@ public extension BaseDataTransaction {
public func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: [QueryClause]) -> [[NSString: AnyObject]]? { public func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: [QueryClause]) -> [[NSString: AnyObject]]? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to query from a \(typeName(self)) outside its designated queue." "Attempted to query from a \(typeName(self)) outside its designated queue."
) )
@@ -2,7 +2,7 @@
// From.swift // From.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,115 +30,269 @@ import CoreData
// MARK: - From // MARK: - From
/** /**
A `Form` clause binds the `NSManagedObject` entity type to the generics type system. A `From` clause specifies the source entity and source persistent store for fetch and query methods. A common usage is to just indicate the entity:
*/ ```
let person = transaction.fetchOne(From(MyPersonEntity))
```
For cases where multiple `NSPersistentStore`s contain the same entity, the source configuration's name needs to be specified as well:
```
let person = transaction.fetchOne(From<MyPersonEntity>("Configuration1"))
```
*/
public struct From<T: NSManagedObject> { public struct From<T: NSManagedObject> {
// MARK: Public /**
Initializes a `From` clause.
Sample Usage:
```
let people = transaction.fetchAll(From<MyPersonEntity>())
```
*/
public init(){ public init(){
self.entityClass = T.self self.init(entityClass: T.self)
self.findPersistentStores = { _ in nil }
} }
/**
Initializes a `From` clause with the specified entity type.
Sample Usage:
```
let people = transaction.fetchAll(From<MyPersonEntity>())
```
- parameter entity: the `NSManagedObject` type to be created
*/
public init(_ entity: T.Type) { public init(_ entity: T.Type) {
self.entityClass = entity self.init(entityClass: entity)
self.findPersistentStores = { _ in nil }
} }
/**
Initializes a `From` clause with the specified entity class.
Sample Usage:
```
let people = transaction.fetchAll(From<MyPersonEntity>())
```
- parameter entityClass: the `NSManagedObject` class type to be created
*/
public init(_ entityClass: AnyClass) { public init(_ entityClass: AnyClass) {
self.entityClass = entityClass self.init(entityClass: entityClass)
self.findPersistentStores = { _ in nil }
} }
public init(_ configurations: String?...) { /**
Initializes a `From` clause with the specified configurations.
Sample Usage:
```
let people = transaction.fetchAll(From<MyPersonEntity>(nil, "Configuration1"))
```
- parameter configuration: the `NSPersistentStore` configuration name to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration.
- parameter otherConfigurations: an optional list of other configuration names to associate objects from (see `configuration` parameter)
*/
public init(_ configuration: String?, otherConfigurations: String?...) {
self.init(entityClass: T.self, configurations: configurations) self.init(entityClass: T.self, configurations: [configuration] + otherConfigurations)
} }
/**
Initializes a `From` clause with the specified configurations.
Sample Usage:
```
let people = transaction.fetchAll(From<MyPersonEntity>(["Configuration1", "Configuration2"]))
```
- parameter configurations: a list of `NSPersistentStore` configuration names to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration.
*/
public init(_ configurations: [String?]) { public init(_ configurations: [String?]) {
self.init(entityClass: T.self, configurations: configurations) self.init(entityClass: T.self, configurations: configurations)
} }
public init(_ entity: T.Type, _ configurations: String?...) { /**
Initializes a `From` clause with the specified configurations.
Sample Usage:
```
let people = transaction.fetchAll(From(MyPersonEntity.self, nil, "Configuration1"))
```
- parameter entity: the associated `NSManagedObject` type
- parameter configuration: the `NSPersistentStore` configuration name to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration.
- parameter otherConfigurations: an optional list of other configuration names to associate objects from (see `configuration` parameter)
*/
public init(_ entity: T.Type, _ configuration: String?, _ otherConfigurations: String?...) {
self.init(entityClass: entity, configurations: configurations) self.init(entityClass: entity, configurations: [configuration] + otherConfigurations)
} }
/**
Initializes a `From` clause with the specified configurations.
Sample Usage:
```
let people = transaction.fetchAll(From(MyPersonEntity.self, ["Configuration1", "Configuration1"]))
```
- parameter entity: the associated `NSManagedObject` type
- parameter configurations: a list of `NSPersistentStore` configuration names to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration.
*/
public init(_ entity: T.Type, _ configurations: [String?]) { public init(_ entity: T.Type, _ configurations: [String?]) {
self.init(entityClass: entity, configurations: configurations) self.init(entityClass: entity, configurations: configurations)
} }
public init(_ entityClass: AnyClass, _ configurations: String?...) { /**
Initializes a `From` clause with the specified configurations.
Sample Usage:
```
let people = transaction.fetchAll(From(MyPersonEntity.self, nil, "Configuration1"))
```
- parameter entity: the associated `NSManagedObject` entity class
- parameter configuration: the `NSPersistentStore` configuration name to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration.
- parameter otherConfigurations: an optional list of other configuration names to associate objects from (see `configuration` parameter)
*/
public init(_ entityClass: AnyClass, _ configuration: String?, _ otherConfigurations: String?...) {
self.init(entityClass: entityClass, configurations: configurations) self.init(entityClass: entityClass, configurations: [configuration] + otherConfigurations)
} }
/**
Initializes a `From` clause with the specified configurations.
Sample Usage:
```
let people = transaction.fetchAll(From(MyPersonEntity.self, ["Configuration1", "Configuration1"]))
```
- parameter entity: the associated `NSManagedObject` entity class
- parameter configurations: a list of `NSPersistentStore` configuration names to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration.
*/
public init(_ entityClass: AnyClass, _ configurations: [String?]) { public init(_ entityClass: AnyClass, _ configurations: [String?]) {
self.init(entityClass: entityClass, configurations: configurations) self.init(entityClass: entityClass, configurations: configurations)
} }
public init(_ storeURLs: NSURL...) { /**
Initializes a `From` clause with the specified store URLs.
self.init(entityClass: T.self, storeURLs: storeURLs) - parameter storeURL: the persistent store URL to associate objects from.
- parameter otherStoreURLs: an optional list of other persistent store URLs to associate objects from (see `storeURL` parameter)
*/
public init(_ storeURL: NSURL, _ otherStoreURLs: NSURL...) {
self.init(entityClass: T.self, storeURLs: [storeURL] + otherStoreURLs)
} }
/**
Initializes a `From` clause with the specified store URLs.
- parameter storeURLs: the persistent store URLs to associate objects from.
*/
public init(_ storeURLs: [NSURL]) { public init(_ storeURLs: [NSURL]) {
self.init(entityClass: T.self, storeURLs: storeURLs) self.init(entityClass: T.self, storeURLs: storeURLs)
} }
public init(_ entity: T.Type, _ storeURLs: NSURL...) { /**
Initializes a `From` clause with the specified store URLs.
self.init(entityClass: entity, storeURLs: storeURLs) - parameter entity: the associated `NSManagedObject` type
- parameter storeURL: the persistent store URL to associate objects from.
- parameter otherStoreURLs: an optional list of other persistent store URLs to associate objects from (see `storeURL` parameter)
*/
public init(_ entity: T.Type, _ storeURL: NSURL, _ otherStoreURLs: NSURL...) {
self.init(entityClass: entity, storeURLs: [storeURL] + otherStoreURLs)
} }
/**
Initializes a `From` clause with the specified store URLs.
- parameter entity: the associated `NSManagedObject` type
- parameter storeURLs: the persistent store URLs to associate objects from.
*/
public init(_ entity: T.Type, _ storeURLs: [NSURL]) { public init(_ entity: T.Type, _ storeURLs: [NSURL]) {
self.init(entityClass: entity, storeURLs: storeURLs) self.init(entityClass: entity, storeURLs: storeURLs)
} }
public init(_ entityClass: AnyClass, _ storeURLs: NSURL...) { /**
Initializes a `From` clause with the specified store URLs.
self.init(entityClass: entityClass, storeURLs: storeURLs) - parameter entity: the associated `NSManagedObject` entity class
- parameter storeURL: the persistent store URL to associate objects from.
- parameter otherStoreURLs: an optional list of other persistent store URLs to associate objects from (see `storeURL` parameter)
*/
public init(_ entityClass: AnyClass, _ storeURL: NSURL, _ otherStoreURLs: NSURL...) {
self.init(entityClass: entityClass, storeURLs: [storeURL] + otherStoreURLs)
} }
/**
Initializes a `From` clause with the specified store URLs.
- parameter entity: the associated `NSManagedObject` entity class
- parameter storeURLs: the persistent store URLs to associate objects from.
*/
public init(_ entityClass: AnyClass, _ storeURLs: [NSURL]) { public init(_ entityClass: AnyClass, _ storeURLs: [NSURL]) {
self.init(entityClass: entityClass, storeURLs: storeURLs) self.init(entityClass: entityClass, storeURLs: storeURLs)
} }
public init(_ persistentStores: NSPersistentStore...) { /**
Initializes a `From` clause with the specified `NSPersistentStore`s.
self.init(entityClass: T.self, persistentStores: persistentStores) - parameter persistentStore: the `NSPersistentStore` to associate objects from.
- parameter otherPersistentStores: an optional list of other `NSPersistentStore`s to associate objects from (see `persistentStore` parameter)
*/
public init(_ persistentStore: NSPersistentStore, _ otherPersistentStores: NSPersistentStore...) {
self.init(entityClass: T.self, persistentStores: [persistentStore] + otherPersistentStores)
} }
/**
Initializes a `From` clause with the specified `NSPersistentStore`s.
- parameter persistentStores: the `NSPersistentStore`s to associate objects from.
*/
public init(_ persistentStores: [NSPersistentStore]) { public init(_ persistentStores: [NSPersistentStore]) {
self.init(entityClass: T.self, persistentStores: persistentStores) self.init(entityClass: T.self, persistentStores: persistentStores)
} }
public init(_ entity: T.Type, _ persistentStores: NSPersistentStore...) { /**
Initializes a `From` clause with the specified `NSPersistentStore`s.
self.init(entityClass: entity, persistentStores: persistentStores) - parameter entity: the associated `NSManagedObject` type
- parameter persistentStore: the `NSPersistentStore` to associate objects from.
- parameter otherPersistentStores: an optional list of other `NSPersistentStore`s to associate objects from (see `persistentStore` parameter)
*/
public init(_ entity: T.Type, _ persistentStore: NSPersistentStore, _ otherPersistentStores: NSPersistentStore...) {
self.init(entityClass: entity, persistentStores: [persistentStore] + otherPersistentStores)
} }
/**
Initializes a `From` clause with the specified `NSPersistentStore`s.
- parameter entity: the associated `NSManagedObject` type
- parameter persistentStores: the `NSPersistentStore`s to associate objects from.
*/
public init(_ entity: T.Type, _ persistentStores: [NSPersistentStore]) { public init(_ entity: T.Type, _ persistentStores: [NSPersistentStore]) {
self.init(entityClass: entity, persistentStores: persistentStores) self.init(entityClass: entity, persistentStores: persistentStores)
} }
public init(_ entityClass: AnyClass, _ persistentStores: NSPersistentStore...) { /**
Initializes a `From` clause with the specified `NSPersistentStore`s.
self.init(entityClass: entityClass, persistentStores: persistentStores) - parameter entity: the associated `NSManagedObject` entity class
- parameter persistentStore: the `NSPersistentStore` to associate objects from.
- parameter otherPersistentStores: an optional list of other `NSPersistentStore`s to associate objects from (see `persistentStore` parameter)
*/
public init(_ entityClass: AnyClass, _ persistentStore: NSPersistentStore, _ otherPersistentStores: NSPersistentStore...) {
self.init(entityClass: entityClass, persistentStores: [persistentStore] + otherPersistentStores)
} }
/**
Initializes a `From` clause with the specified `NSPersistentStore`s.
- parameter entity: the associated `NSManagedObject` entity class
- parameter persistentStores: the `NSPersistentStore`s to associate objects from.
*/
public init(_ entityClass: AnyClass, _ persistentStores: [NSPersistentStore]) { public init(_ entityClass: AnyClass, _ persistentStores: [NSPersistentStore]) {
self.init(entityClass: entityClass, persistentStores: persistentStores) self.init(entityClass: entityClass, persistentStores: persistentStores)
@@ -147,10 +301,20 @@ public struct From<T: NSManagedObject> {
// MARK: Internal // MARK: Internal
internal func applyToFetchRequest(fetchRequest: NSFetchRequest, context: NSManagedObjectContext) { internal func applyToFetchRequest(fetchRequest: NSFetchRequest, context: NSManagedObjectContext, applyAffectedStores: Bool = true) {
fetchRequest.entity = context.entityDescriptionForEntityClass(self.entityClass) fetchRequest.entity = context.entityDescriptionForEntityClass(self.entityClass)
fetchRequest.affectedStores = self.findPersistentStores(context: context) if applyAffectedStores {
self.applyAffectedStoresForFetchedRequest(fetchRequest, context: context)
}
}
internal func applyAffectedStoresForFetchedRequest(fetchRequest: NSFetchRequest, context: NSManagedObjectContext) -> Bool {
let stores = self.findPersistentStores(context: context)
fetchRequest.affectedStores = stores
return stores?.isEmpty == false
} }
@@ -160,6 +324,15 @@ public struct From<T: NSManagedObject> {
private let findPersistentStores: (context: NSManagedObjectContext) -> [NSPersistentStore]? private let findPersistentStores: (context: NSManagedObjectContext) -> [NSPersistentStore]?
private init(entityClass: AnyClass) {
self.entityClass = entityClass
self.findPersistentStores = { (context: NSManagedObjectContext) -> [NSPersistentStore]? in
return context.parentStack?.persistentStoresForEntityClass(entityClass)
}
}
private init(entityClass: AnyClass, configurations: [String?]) { private init(entityClass: AnyClass, configurations: [String?]) {
let configurationsSet = Set(configurations.map { $0 ?? Into.defaultConfigurationName }) let configurationsSet = Set(configurations.map { $0 ?? Into.defaultConfigurationName })
@@ -2,7 +2,7 @@
// GroupBy.swift // GroupBy.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,12 +30,10 @@ import CoreData
// MARK: - GroupBy // MARK: - GroupBy
/** /**
The `GroupBy` clause specifies that the result of a query be grouped accoording to the specified key path. The `GroupBy` clause specifies that the result of a query be grouped accoording to the specified key path.
*/ */
public struct GroupBy: QueryClause { public struct GroupBy: QueryClause {
// MARK: Public
/** /**
Initializes a `GroupBy` clause with a list of key path strings Initializes a `GroupBy` clause with a list of key path strings
@@ -72,7 +70,7 @@ public struct GroupBy: QueryClause {
public func applyToFetchRequest(fetchRequest: NSFetchRequest) { public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
if fetchRequest.propertiesToGroupBy != nil { if let keyPaths = fetchRequest.propertiesToGroupBy as? [String] where keyPaths != self.keyPaths {
CoreStore.log( CoreStore.log(
.Warning, .Warning,
@@ -2,7 +2,7 @@
// OrderBy.swift // OrderBy.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -46,8 +46,8 @@ public typealias KeyPath = String
// MARK: - SortKey // MARK: - SortKey
/** /**
The `SortKey` is passed to the `OrderBy` clause to indicate the sort keys and their sort direction. The `SortKey` is passed to the `OrderBy` clause to indicate the sort keys and their sort direction.
*/ */
public enum SortKey { public enum SortKey {
/** /**
@@ -65,12 +65,10 @@ public enum SortKey {
// MARK: - OrderBy // MARK: - OrderBy
/** /**
The `OrderBy` clause specifies the sort order for results for a fetch or a query. The `OrderBy` clause specifies the sort order for results for a fetch or a query.
*/ */
public struct OrderBy: FetchClause, QueryClause, DeleteClause { public struct OrderBy: FetchClause, QueryClause, DeleteClause {
// MARK: Public
/** /**
Initializes a `OrderBy` clause with a list of sort descriptors Initializes a `OrderBy` clause with a list of sort descriptors
@@ -139,7 +137,7 @@ public struct OrderBy: FetchClause, QueryClause, DeleteClause {
public func applyToFetchRequest(fetchRequest: NSFetchRequest) { public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
if fetchRequest.sortDescriptors != nil { if let sortDescriptors = fetchRequest.sortDescriptors where sortDescriptors != self.sortDescriptors {
CoreStore.log( CoreStore.log(
.Warning, .Warning,
@@ -2,7 +2,7 @@
// Select.swift // Select.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,16 +30,16 @@ import CoreData
// MARK: - SelectResultType // MARK: - SelectResultType
/** /**
The `SelectResultType` protocol is implemented by return types supported by the `Select` clause. The `SelectResultType` protocol is implemented by return types supported by the `Select` clause.
*/ */
public protocol SelectResultType { } public protocol SelectResultType { }
// MARK: - SelectValueResultType // MARK: - SelectValueResultType
/** /**
The `SelectValueResultType` protocol is implemented by return types supported by the `queryValue(...)` methods. The `SelectValueResultType` protocol is implemented by return types supported by the `queryValue(...)` methods.
*/ */
public protocol SelectValueResultType: SelectResultType { public protocol SelectValueResultType: SelectResultType {
static func fromResultObject(result: AnyObject) -> Self? static func fromResultObject(result: AnyObject) -> Self?
@@ -49,8 +49,8 @@ public protocol SelectValueResultType: SelectResultType {
// MARK: - SelectAttributesResultType // MARK: - SelectAttributesResultType
/** /**
The `SelectValueResultType` protocol is implemented by return types supported by the `queryAttributes(...)` methods. The `SelectValueResultType` protocol is implemented by return types supported by the `queryAttributes(...)` methods.
*/ */
public protocol SelectAttributesResultType: SelectResultType { public protocol SelectAttributesResultType: SelectResultType {
static func fromResultObjects(result: [AnyObject]) -> [[NSString: AnyObject]] static func fromResultObjects(result: [AnyObject]) -> [[NSString: AnyObject]]
@@ -60,29 +60,27 @@ public protocol SelectAttributesResultType: SelectResultType {
// MARK: - SelectTerm // MARK: - SelectTerm
/** /**
The `SelectTerm` is passed to the `Select` clause to indicate the attributes/aggregate keys to be queried. The `SelectTerm` is passed to the `Select` clause to indicate the attributes/aggregate keys to be queried.
*/ */
public enum SelectTerm: StringLiteralConvertible { public enum SelectTerm: StringLiteralConvertible {
// MARK: Public
/** /**
Provides a `SelectTerm` to a `Select` clause for querying an entity attribute. A shorter way to do the same is to assign from the string keypath directly: Provides a `SelectTerm` to a `Select` clause for querying an entity attribute. A shorter way to do the same is to assign from the string keypath directly:
```
let fullName = CoreStore.queryValue( let fullName = CoreStore.queryValue(
From(MyPersonEntity), From(MyPersonEntity),
Select<String>(.Attribute("fullName")), Select<String>(.Attribute("fullName")),
Where("employeeID", isEqualTo: 1111) Where("employeeID", isEqualTo: 1111)
) )
```
is equivalent to: is equivalent to:
```
let fullName = CoreStore.queryValue( let fullName = CoreStore.queryValue(
From(MyPersonEntity), From(MyPersonEntity),
Select<String>("fullName"), Select<String>("fullName"),
Where("employeeID", isEqualTo: 1111) Where("employeeID", isEqualTo: 1111)
) )
```
- parameter keyPath: the attribute name - parameter keyPath: the attribute name
- returns: a `SelectTerm` to a `Select` clause for querying an entity attribute - returns: a `SelectTerm` to a `Select` clause for querying an entity attribute
*/ */
@@ -93,12 +91,12 @@ public enum SelectTerm: StringLiteralConvertible {
/** /**
Provides a `SelectTerm` to a `Select` clause for querying the average value of an attribute. Provides a `SelectTerm` to a `Select` clause for querying the average value of an attribute.
```
let averageAge = CoreStore.queryValue( let averageAge = CoreStore.queryValue(
From(MyPersonEntity), From(MyPersonEntity),
Select<Int>(.Average("age")) Select<Int>(.Average("age"))
) )
```
- parameter keyPath: the attribute name - parameter keyPath: the attribute name
- parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "average(<attributeName>)" is used - parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "average(<attributeName>)" is used
- returns: a `SelectTerm` to a `Select` clause for querying the average value of an attribute - returns: a `SelectTerm` to a `Select` clause for querying the average value of an attribute
@@ -115,12 +113,12 @@ public enum SelectTerm: StringLiteralConvertible {
/** /**
Provides a `SelectTerm` to a `Select` clause for a count query. Provides a `SelectTerm` to a `Select` clause for a count query.
```
let numberOfEmployees = CoreStore.queryValue( let numberOfEmployees = CoreStore.queryValue(
From(MyPersonEntity), From(MyPersonEntity),
Select<Int>(.Count("employeeID")) Select<Int>(.Count("employeeID"))
) )
```
- parameter keyPath: the attribute name - parameter keyPath: the attribute name
- parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "count(<attributeName>)" is used - parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "count(<attributeName>)" is used
- returns: a `SelectTerm` to a `Select` clause for a count query - returns: a `SelectTerm` to a `Select` clause for a count query
@@ -137,12 +135,12 @@ public enum SelectTerm: StringLiteralConvertible {
/** /**
Provides a `SelectTerm` to a `Select` clause for querying the maximum value for an attribute. Provides a `SelectTerm` to a `Select` clause for querying the maximum value for an attribute.
```
let maximumAge = CoreStore.queryValue( let maximumAge = CoreStore.queryValue(
From(MyPersonEntity), From(MyPersonEntity),
Select<Int>(.Maximum("age")) Select<Int>(.Maximum("age"))
) )
```
- parameter keyPath: the attribute name - parameter keyPath: the attribute name
- parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "max(<attributeName>)" is used - parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "max(<attributeName>)" is used
- returns: a `SelectTerm` to a `Select` clause for querying the maximum value for an attribute - returns: a `SelectTerm` to a `Select` clause for querying the maximum value for an attribute
@@ -159,12 +157,12 @@ public enum SelectTerm: StringLiteralConvertible {
/** /**
Provides a `SelectTerm` to a `Select` clause for querying the minimum value for an attribute. Provides a `SelectTerm` to a `Select` clause for querying the minimum value for an attribute.
```
let minimumAge = CoreStore.queryValue( let minimumAge = CoreStore.queryValue(
From(MyPersonEntity), From(MyPersonEntity),
Select<Int>(.Minimum("age")) Select<Int>(.Minimum("age"))
) )
```
- parameter keyPath: the attribute name - parameter keyPath: the attribute name
- parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "min(<attributeName>)" is used - parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "min(<attributeName>)" is used
- returns: a `SelectTerm` to a `Select` clause for querying the minimum value for an attribute - returns: a `SelectTerm` to a `Select` clause for querying the minimum value for an attribute
@@ -181,12 +179,12 @@ public enum SelectTerm: StringLiteralConvertible {
/** /**
Provides a `SelectTerm` to a `Select` clause for querying the sum value for an attribute. Provides a `SelectTerm` to a `Select` clause for querying the sum value for an attribute.
```
let totalAge = CoreStore.queryValue( let totalAge = CoreStore.queryValue(
From(MyPersonEntity), From(MyPersonEntity),
Select<Int>(.Sum("age")) Select<Int>(.Sum("age"))
) )
```
- parameter keyPath: the attribute name - parameter keyPath: the attribute name
- parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "sum(<attributeName>)" is used - parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "sum(<attributeName>)" is used
- returns: a `SelectTerm` to a `Select` clause for querying the sum value for an attribute - returns: a `SelectTerm` to a `Select` clause for querying the sum value for an attribute
@@ -230,25 +228,25 @@ public enum SelectTerm: StringLiteralConvertible {
// MARK: - Select // MARK: - Select
/** /**
The `Select` clause indicates the attribute / aggregate value to be queried. The generic type is a `SelectResultType`, and will be used as the return type for the query. The `Select` clause indicates the attribute / aggregate value to be queried. The generic type is a `SelectResultType`, and will be used as the return type for the query.
You can bind the return type by specializing the initializer:
You can bind the return type by specializing the initializer:
```
let maximumAge = CoreStore.queryValue( let maximumAge = CoreStore.queryValue(
From(MyPersonEntity), From(MyPersonEntity),
Select<Int>(.Maximum("age")) Select<Int>(.Maximum("age"))
) )
```
or by casting the type of the return value: or by casting the type of the return value:
```
let maximumAge: Int = CoreStore.queryValue( let maximumAge: Int = CoreStore.queryValue(
From(MyPersonEntity), From(MyPersonEntity),
Select(.Maximum("age")) Select(.Maximum("age"))
) )
```
Valid return types depend on the query:
Valid return types depend on the query: - for `queryValue(...)` methods:
- for `queryValue(...)` methods:
- `Bool` - `Bool`
- `Int8` - `Int8`
- `Int16` - `Int16`
@@ -264,15 +262,13 @@ Valid return types depend on the query:
- `NSData` - `NSData`
- `NSManagedObjectID` - `NSManagedObjectID`
- `NSString` - `NSString`
- for `queryAttributes(...)` methods: - for `queryAttributes(...)` methods:
- `NSDictionary` - `NSDictionary`
- parameter sortDescriptors: a series of `NSSortDescriptor`s - parameter sortDescriptors: a series of `NSSortDescriptor`s
*/ */
public struct Select<T: SelectResultType> { public struct Select<T: SelectResultType> {
// MARK: Public
/** /**
The `SelectResultType` type for the query's return value The `SelectResultType` type for the query's return value
*/ */
@@ -2,7 +2,7 @@
// Tweak.swift // Tweak.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,10 +30,9 @@ import CoreData
// MARK: - Tweak // MARK: - Tweak
/** /**
The `Tweak` clause allows fine-tuning the `NSFetchRequest` for a fetch or query. The `Tweak` clause allows fine-tuning the `NSFetchRequest` for a fetch or query.
Sample usage:
Sample usage: ```
let employees = transaction.fetchAll( let employees = transaction.fetchAll(
From(MyPersonEntity), From(MyPersonEntity),
Tweak { (fetchRequest) -> Void in Tweak { (fetchRequest) -> Void in
@@ -41,11 +40,10 @@ Sample usage:
fetchRequest.fetchLimit = 5 fetchRequest.fetchLimit = 5
} }
) )
*/ ```
*/
public struct Tweak: FetchClause, QueryClause, DeleteClause { public struct Tweak: FetchClause, QueryClause, DeleteClause {
// MARK: Public
/** /**
Initializes a `Tweak` clause with a closure where the `NSFetchRequest` may be configured. Initializes a `Tweak` clause with a closure where the `NSFetchRequest` may be configured.
@@ -65,5 +63,7 @@ public struct Tweak: FetchClause, QueryClause, DeleteClause {
} }
// MARK: Private
private let customization: (fetchRequest: NSFetchRequest) -> Void private let customization: (fetchRequest: NSFetchRequest) -> Void
} }
@@ -2,7 +2,7 @@
// Where.swift // Where.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -46,12 +46,10 @@ public prefix func !(clause: Where) -> Where {
// MARK: - Where // MARK: - Where
/** /**
The `Where` clause specifies the conditions for a fetch or a query. The `Where` clause specifies the conditions for a fetch or a query.
*/ */
public struct Where: FetchClause, QueryClause, DeleteClause { public struct Where: FetchClause, QueryClause, DeleteClause {
// MARK: Public
/** /**
Initializes a `Where` clause with an `NSPredicate` Initializes a `Where` clause with an `NSPredicate`
@@ -144,7 +142,7 @@ public struct Where: FetchClause, QueryClause, DeleteClause {
public func applyToFetchRequest(fetchRequest: NSFetchRequest) { public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
if fetchRequest.predicate != nil { if let predicate = fetchRequest.predicate where predicate != self.predicate {
CoreStore.log( CoreStore.log(
.Warning, .Warning,
@@ -2,7 +2,7 @@
// CoreStore+Querying.swift // CoreStore+Querying.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -31,8 +31,6 @@ import CoreData
public extension CoreStore { public extension CoreStore {
// MARK: Public
/** /**
Using the `defaultStack`, fetches the `NSManagedObject` instance in the `DataStack`'s context from a reference created from a transaction or from a different managed object context. Using the `defaultStack`, fetches the `NSManagedObject` instance in the `DataStack`'s context from a reference created from a transaction or from a different managed object context.
@@ -2,7 +2,7 @@
// DataStack+Querying.swift // DataStack+Querying.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -34,8 +34,6 @@ import CoreData
public extension DataStack { public extension DataStack {
// MARK: Public
/** /**
Fetches the `NSManagedObject` instance in the `DataStack`'s context from a reference created from a transaction or from a different managed object context. Fetches the `NSManagedObject` instance in the `DataStack`'s context from a reference created from a transaction or from a different managed object context.
@@ -2,7 +2,7 @@
// ClauseTypes.swift // ClauseTypes.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -29,6 +29,9 @@ import CoreData
// MARK: - FetchClause // MARK: - FetchClause
/**
The `FetchClause` implement clauses used to configure `NSFetchRequest`s.
*/
public protocol FetchClause { public protocol FetchClause {
func applyToFetchRequest(fetchRequest: NSFetchRequest) func applyToFetchRequest(fetchRequest: NSFetchRequest)
@@ -37,6 +40,9 @@ public protocol FetchClause {
// MARK: - QueryClause // MARK: - QueryClause
/**
The `QueryClause` implement clauses used to configure `NSFetchRequest`s.
*/
public protocol QueryClause { public protocol QueryClause {
func applyToFetchRequest(fetchRequest: NSFetchRequest) func applyToFetchRequest(fetchRequest: NSFetchRequest)
@@ -45,6 +51,9 @@ public protocol QueryClause {
// MARK: - DeleteClause // MARK: - DeleteClause
/**
The `DeleteClause` implement clauses used to configure `NSFetchRequest`s.
*/
public protocol DeleteClause { public protocol DeleteClause {
func applyToFetchRequest(fetchRequest: NSFetchRequest) func applyToFetchRequest(fetchRequest: NSFetchRequest)
@@ -2,7 +2,7 @@
// BaseDataTransaction+Importing.swift // BaseDataTransaction+Importing.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -31,8 +31,6 @@ import CoreData
public extension BaseDataTransaction { public extension BaseDataTransaction {
// MARK: Public
/** /**
Creates an `ImportableObject` by importing from the specified import source. Creates an `ImportableObject` by importing from the specified import source.
@@ -45,7 +43,7 @@ public extension BaseDataTransaction {
source: T.ImportSource) throws -> T? { source: T.ImportSource) throws -> T? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to import an object of type \(typeName(into.entityClass)) outside the transaction's designated queue." "Attempted to import an object of type \(typeName(into.entityClass)) outside the transaction's designated queue."
) )
@@ -62,6 +60,32 @@ public extension BaseDataTransaction {
} }
} }
/**
Updates an existing `ImportableObject` by importing values from the specified import source.
- parameter object: the `NSManagedObject` to update
- parameter source: the object to import values from
*/
public func importObject<T where T: NSManagedObject, T: ImportableObject>(
object: T,
source: T.ImportSource) throws {
CoreStore.assert(
self.isRunningInAllowedQueue(),
"Attempted to import an object of type \(typeName(object)) outside the transaction's designated queue."
)
try autoreleasepool {
guard T.shouldInsertFromImportSource(source, inTransaction: self) else {
return
}
try object.didInsertFromImportSource(source, inTransaction: self)
}
}
/** /**
Creates multiple `ImportableObject`s by importing from the specified array of import sources. Creates multiple `ImportableObject`s by importing from the specified array of import sources.
@@ -74,7 +98,7 @@ public extension BaseDataTransaction {
sourceArray: S) throws -> [T] { sourceArray: S) throws -> [T] {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to import an object of type \(typeName(into.entityClass)) outside the transaction's designated queue." "Attempted to import an object of type \(typeName(into.entityClass)) outside the transaction's designated queue."
) )
@@ -109,7 +133,7 @@ public extension BaseDataTransaction {
source: T.ImportSource) throws -> T? { source: T.ImportSource) throws -> T? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to import an object of type \(typeName(into.entityClass)) outside the transaction's designated queue." "Attempted to import an object of type \(typeName(into.entityClass)) outside the transaction's designated queue."
) )
@@ -123,6 +147,11 @@ public extension BaseDataTransaction {
if let object = self.fetchOne(From(T), Where(uniqueIDKeyPath, isEqualTo: uniqueIDValue)) { if let object = self.fetchOne(From(T), Where(uniqueIDKeyPath, isEqualTo: uniqueIDValue)) {
guard T.shouldUpdateFromImportSource(source, inTransaction: self) else {
return nil
}
try object.updateFromImportSource(source, inTransaction: self) try object.updateFromImportSource(source, inTransaction: self)
return object return object
} }
@@ -155,7 +184,7 @@ public extension BaseDataTransaction {
@noescape preProcess: (mapping: [T.UniqueIDType: T.ImportSource]) throws -> [T.UniqueIDType: T.ImportSource] = { $0 }) throws -> [T] { @noescape preProcess: (mapping: [T.UniqueIDType: T.ImportSource]) throws -> [T.UniqueIDType: T.ImportSource] = { $0 }) throws -> [T] {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to import an object of type \(typeName(into.entityClass)) outside the transaction's designated queue." "Attempted to import an object of type \(typeName(into.entityClass)) outside the transaction's designated queue."
) )
@@ -2,7 +2,7 @@
// ImportableObject.swift // ImportableObject.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,8 +30,8 @@ import CoreData
// MARK: - ImportableObject // MARK: - ImportableObject
/** /**
`NSManagedObject` subclasses that conform to the `ImportableObject` protocol can be imported from a specified `ImportSource`. This allows transactions to create and insert instances this way: `NSManagedObject` subclasses that conform to the `ImportableObject` protocol can be imported from a specified `ImportSource`. This allows transactions to create and insert instances this way:
```
class MyPersonEntity: NSManagedObject, ImportableObject { class MyPersonEntity: NSManagedObject, ImportableObject {
typealias ImportSource = NSDictionary typealias ImportSource = NSDictionary
// ... // ...
@@ -46,7 +46,8 @@ import CoreData
// ... // ...
transaction.commit() transaction.commit()
} }
*/ ```
*/
public protocol ImportableObject: class { public protocol ImportableObject: class {
/** /**
@@ -2,7 +2,7 @@
// ImportableUniqueObject.swift // ImportableUniqueObject.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,8 +30,8 @@ import CoreData
// MARK: - ImportableUniqueObject // MARK: - ImportableUniqueObject
/** /**
`NSManagedObject` subclasses that conform to the `ImportableUniqueObject` protocol can be imported from a specified `ImportSource`. This allows transactions to either update existing objects or create new instances this way: `NSManagedObject` subclasses that conform to the `ImportableUniqueObject` protocol can be imported from a specified `ImportSource`. This allows transactions to either update existing objects or create new instances this way:
```
class MyPersonEntity: NSManagedObject, ImportableUniqueObject { class MyPersonEntity: NSManagedObject, ImportableUniqueObject {
typealias ImportSource = NSDictionary typealias ImportSource = NSDictionary
typealias UniqueIDType = NSString typealias UniqueIDType = NSString
@@ -47,7 +47,8 @@ import CoreData
// ... // ...
transaction.commit() transaction.commit()
} }
*/ ```
*/
public protocol ImportableUniqueObject: ImportableObject { public protocol ImportableUniqueObject: ImportableObject {
/** /**
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.3.6</string> <string>1.5.1</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
+1 -1
View File
@@ -2,7 +2,7 @@
// NSObject+CoreStore.swift // NSObject+CoreStore.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,101 @@
//
// CoreStoreFetchedResultsController.swift
// CoreStore
//
// Copyright © 2016 John Rommel Estropia
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
import Foundation
import CoreData
// MARK: - CoreStoreFetchedResultsController
@available(OSX, unavailable)
internal final class CoreStoreFetchedResultsController<T: NSManagedObject>: NSFetchedResultsController {
// MARK: Internal
internal convenience init<T>(dataStack: DataStack, fetchRequest: NSFetchRequest, from: From<T>? = nil, sectionBy: SectionBy? = nil, fetchClauses: [FetchClause]) {
self.init(
context: dataStack.mainContext,
fetchRequest: fetchRequest,
from: from,
sectionBy: sectionBy,
fetchClauses: fetchClauses
)
}
internal init<T>(context: NSManagedObjectContext, fetchRequest: NSFetchRequest, from: From<T>? = nil, sectionBy: SectionBy? = nil, fetchClauses: [FetchClause]) {
from?.applyToFetchRequest(fetchRequest, context: context, applyAffectedStores: false)
for clause in fetchClauses {
clause.applyToFetchRequest(fetchRequest)
}
if let from = from {
self.reapplyAffectedStores = {
return from.applyAffectedStoresForFetchedRequest(fetchRequest, context: context)
}
}
else {
guard let from = (fetchRequest.entity.flatMap { $0.managedObjectClassName }).flatMap(NSClassFromString).flatMap(From.init) else {
fatalError("Attempted to create an \(typeName(NSFetchedResultsController)) without a From clause or an NSEntityDescription.")
}
self.reapplyAffectedStores = {
return from.applyAffectedStoresForFetchedRequest(fetchRequest, context: context)
}
}
super.init(
fetchRequest: fetchRequest,
managedObjectContext: context,
sectionNameKeyPath: sectionBy?.sectionKeyPath,
cacheName: nil
)
}
internal func performFetchFromSpecifiedStores() throws {
if !self.reapplyAffectedStores() {
CoreStore.log(
.Warning,
message: "Attempted to perform a fetch on an \(typeName(NSFetchedResultsController)) but could not find any persistent store for the entity \(typeName(self.fetchRequest.entityName))"
)
}
try self.performFetch()
}
// MARK: Private
private let reapplyAffectedStores: () -> Bool
}
@@ -2,7 +2,7 @@
// FetchedResultsControllerDelegate.swift // FetchedResultsControllerDelegate.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -2,7 +2,7 @@
// Functions.swift // Functions.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -2,7 +2,7 @@
// MigrationManager.swift // MigrationManager.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,7 +2,7 @@
// NSManagedObjectContext+CoreStore.swift // NSManagedObjectContext+CoreStore.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,7 +2,7 @@
// NSManagedObjectContext+Querying.swift // NSManagedObjectContext+Querying.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,7 +2,7 @@
// NSManagedObjectContext+Setup.swift // NSManagedObjectContext+Setup.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,7 +2,7 @@
// NSManagedObjectContext+Transaction.swift // NSManagedObjectContext+Transaction.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -55,6 +55,15 @@ internal extension NSManagedObjectContext {
} }
} }
internal func isRunningInAllowedQueue() -> Bool {
guard let parentTransaction = self.parentTransaction else {
return false
}
return parentTransaction.isRunningInAllowedQueue()
}
internal func temporaryContextInTransactionWithConcurrencyType(concurrencyType: NSManagedObjectContextConcurrencyType) -> NSManagedObjectContext { internal func temporaryContextInTransactionWithConcurrencyType(concurrencyType: NSManagedObjectContextConcurrencyType) -> NSManagedObjectContext {
let context = NSManagedObjectContext(concurrencyType: concurrencyType) let context = NSManagedObjectContext(concurrencyType: concurrencyType)
@@ -158,6 +167,18 @@ internal extension NSManagedObjectContext {
} }
} }
internal func refreshAllObjectsAsFaults() {
if #available(iOS 8.3, OSX 10.11, *) {
self.refreshAllObjects()
}
else {
self.registeredObjects.forEach { self.refreshObject($0, mergeChanges: false) }
}
}
// MARK: Private // MARK: Private
@@ -2,7 +2,7 @@
// NSManagedObjectModel+Setup.swift // NSManagedObjectModel+Setup.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,7 +2,7 @@
// NotificationObserver.swift // NotificationObserver.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -2,7 +2,7 @@
// WeakObject.swift // WeakObject.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
+1 -3
View File
@@ -2,7 +2,7 @@
// CoreStore+Logging.swift // CoreStore+Logging.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,8 +30,6 @@ import Foundation
public extension CoreStore { public extension CoreStore {
// MARK: Public
/** /**
The `CoreStoreLogger` instance to be used. The default logger is an instance of a `DefaultLogger`. The `CoreStoreLogger` instance to be used. The default logger is an instance of a `DefaultLogger`.
*/ */
+7 -8
View File
@@ -2,7 +2,7 @@
// CoreStoreLogger.swift // CoreStoreLogger.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,8 @@ import Foundation
// MARK: - LogLevel // MARK: - LogLevel
/** /**
The `LogLevel` indicates the severity of a log message. The `LogLevel` indicates the severity of a log message.
*/ */
public enum LogLevel { public enum LogLevel {
case Trace case Trace
@@ -43,8 +43,8 @@ public enum LogLevel {
// MARK: - CoreStoreLogger // MARK: - CoreStoreLogger
/** /**
Custom loggers should implement the `CoreStoreLogger` protocol and pass its instance to `CoreStore.logger`. Calls to `log(...)`, `handleError(...)`, and `assert(...)` are not tied to a specific queue/thread, so it is the implementer's job to handle thread-safety. Custom loggers should implement the `CoreStoreLogger` protocol and pass its instance to `CoreStore.logger`. Calls to `log(...)`, `handleError(...)`, and `assert(...)` are not tied to a specific queue/thread, so it is the implementer's job to handle thread-safety.
*/ */
public protocol CoreStoreLogger { public protocol CoreStoreLogger {
/** /**
@@ -86,7 +86,7 @@ public protocol CoreStoreLogger {
internal func typeName<T>(value: T) -> String { internal func typeName<T>(value: T) -> String {
return "'\(_stdlib_getDemangledTypeName(value))'" return "'\(String(reflecting: value.dynamicType))'"
} }
internal func typeName<T>(value: T.Type) -> String { internal func typeName<T>(value: T.Type) -> String {
@@ -101,6 +101,5 @@ internal func typeName(value: AnyClass) -> String {
internal func typeName(name: String?) -> String { internal func typeName(name: String?) -> String {
let typeName = name ?? "unknown" return "<\(name ?? "unknown")>"
return "<\(typeName)>"
} }
+6 -6
View File
@@ -2,7 +2,7 @@
// DefaultLogger.swift // DefaultLogger.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -29,12 +29,12 @@ import Foundation
// MARK: - DefaultLogger // MARK: - DefaultLogger
/** /**
The `DefaultLogger` is a basic implementation of the `CoreStoreLogger` protocol. The `DefaultLogger` is a basic implementation of the `CoreStoreLogger` protocol.
- The `log(...)` method calls `print(...)` to print the level, source file name, line number, function name, and the log message. - The `log(...)` method calls `print(...)` to print the level, source file name, line number, function name, and the log message.
- The `handleError(...)` method calls `print(...)` to print the source file name, line number, function name, and the error message. - The `handleError(...)` method calls `print(...)` to print the source file name, line number, function name, and the error message.
- The `assert(...)` method calls `assert(...)` on the arguments. - The `assert(...)` method calls `assert(...)` on the arguments.
*/ */
public final class DefaultLogger: CoreStoreLogger { public final class DefaultLogger: CoreStoreLogger {
public init() { } public init() { }
@@ -2,7 +2,7 @@
// CoreStore+Migration.swift // CoreStore+Migration.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -37,7 +37,7 @@ public extension CoreStore {
/** /**
Asynchronously adds to the `defaultStack` an SQLite store from the given SQLite file name. Note that using `addSQLiteStore(...)` instead of `addSQLiteStoreAndWait(...)` implies that the migrations are allowed and expected (thus the asynchronous `completion`.) Asynchronously adds to the `defaultStack` an SQLite store from the given SQLite file name. Note that using `addSQLiteStore(...)` instead of `addSQLiteStoreAndWait(...)` implies that the migrations are allowed and expected (thus the asynchronous `completion`.)
- parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory. A new SQLite file will be created if it does not exist. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them. - parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory (or the "Caches" directory on tvOS). A new SQLite file will be created if it does not exist. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them.
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them.
- parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.allBundles()`. - parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.allBundles()`.
- parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to report failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false. - parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to report failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false.
@@ -58,7 +58,7 @@ public extension CoreStore {
/** /**
Asynchronously adds to the `defaultStack` an SQLite store from the given SQLite file URL. Note that using `addSQLiteStore(...)` instead of `addSQLiteStoreAndWait(...)` implies that the migrations are allowed and expected (thus the asynchronous `completion`.) Asynchronously adds to the `defaultStack` an SQLite store from the given SQLite file URL. Note that using `addSQLiteStore(...)` instead of `addSQLiteStoreAndWait(...)` implies that the migrations are allowed and expected (thus the asynchronous `completion`.)
- parameter fileURL: the local file URL for the SQLite persistent store. A new SQLite file will be created if it does not exist. If not specified, defaults to a file URL pointing to a "<Application name>.sqlite" file in the "Application Support" directory. Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them. - parameter fileURL: the local file URL for the SQLite persistent store. A new SQLite file will be created if it does not exist. If not specified, defaults to a file URL pointing to a "<Application name>.sqlite" file in the "Application Support" directory (or the "Caches" directory on tvOS). Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them.
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them.
- parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.allBundles()`. - parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.allBundles()`.
- parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to report failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false. - parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to report failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false.
@@ -79,7 +79,7 @@ public extension CoreStore {
/** /**
Using the `defaultStack`, migrates an SQLite store with the specified filename to the `DataStack`'s managed object model version WITHOUT adding the migrated store to the data stack. Using the `defaultStack`, migrates an SQLite store with the specified filename to the `DataStack`'s managed object model version WITHOUT adding the migrated store to the data stack.
- parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory. - parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory (or the "Caches" directory on tvOS).
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil` which indicates the "Default" configuration. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil` which indicates the "Default" configuration.
- parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`. - parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`.
- parameter sourceBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`. - parameter sourceBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`.
@@ -98,7 +98,7 @@ public extension CoreStore {
/** /**
Using the `defaultStack`, migrates an SQLite store at the specified file URL and configuration name to the `DataStack`'s managed object model version. This method does NOT add the migrated store to the data stack. Using the `defaultStack`, migrates an SQLite store at the specified file URL and configuration name to the `DataStack`'s managed object model version. This method does NOT add the migrated store to the data stack.
- parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory. - parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory (or the "Caches" directory on tvOS).
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil` which indicates the "Default" configuration. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil` which indicates the "Default" configuration.
- parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`. - parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`.
- parameter sourceBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`. - parameter sourceBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`.
@@ -117,7 +117,7 @@ public extension CoreStore {
/** /**
Using the `defaultStack`, checks for the required migrations needed for the store with the specified filename and configuration to be migrated to the `DataStack`'s managed object model version. This method throws an error if the store does not exist, if inspection of the store failed, or no mapping model was found/inferred. Using the `defaultStack`, checks for the required migrations needed for the store with the specified filename and configuration to be migrated to the `DataStack`'s managed object model version. This method throws an error if the store does not exist, if inspection of the store failed, or no mapping model was found/inferred.
- parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory. - parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory (or the "Caches" directory on tvOS).
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil` which indicates the "Default" configuration. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil` which indicates the "Default" configuration.
- parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.allBundles()`. - parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.allBundles()`.
:return: an array of `MigrationType`s indicating the chain of migrations required for the store; or `nil` if either inspection of the store failed, or no mapping model was found/inferred. `MigrationType` acts as a `Bool` and evaluates to `false` if no migration is required, and `true` if either a lightweight or custom migration is needed. :return: an array of `MigrationType`s indicating the chain of migrations required for the store; or `nil` if either inspection of the store failed, or no mapping model was found/inferred. `MigrationType` acts as a `Bool` and evaluates to `false` if no migration is required, and `true` if either a lightweight or custom migration is needed.
@@ -2,7 +2,7 @@
// DataStack+Migration.swift // DataStack+Migration.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -78,7 +78,7 @@ public extension DataStack {
/** /**
Asynchronously adds to the stack an SQLite store from the given SQLite file name. Note that using `addSQLiteStore(...)` instead of `addSQLiteStoreAndWait(...)` implies that the migrations are allowed and expected (thus the asynchronous `completion`.) Asynchronously adds to the stack an SQLite store from the given SQLite file name. Note that using `addSQLiteStore(...)` instead of `addSQLiteStoreAndWait(...)` implies that the migrations are allowed and expected (thus the asynchronous `completion`.)
- parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory. A new SQLite file will be created if it does not exist. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them. - parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory (or the "Caches" directory on tvOS). A new SQLite file will be created if it does not exist. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them.
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them.
- parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.allBundles()`. - parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.allBundles()`.
- parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to report failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false. - parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to report failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false.
@@ -88,7 +88,7 @@ public extension DataStack {
public func addSQLiteStore(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle]? = nil, resetStoreOnModelMismatch: Bool = false, completion: (PersistentStoreResult) -> Void) throws -> NSProgress? { public func addSQLiteStore(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle]? = nil, resetStoreOnModelMismatch: Bool = false, completion: (PersistentStoreResult) -> Void) throws -> NSProgress? {
return try self.addSQLiteStore( return try self.addSQLiteStore(
fileURL: applicationSupportDirectory.URLByAppendingPathComponent( fileURL: defaultDirectory.URLByAppendingPathComponent(
fileName, fileName,
isDirectory: false isDirectory: false
), ),
@@ -102,7 +102,7 @@ public extension DataStack {
/** /**
Asynchronously adds to the stack an SQLite store from the given SQLite file URL. Note that using `addSQLiteStore(...)` instead of `addSQLiteStoreAndWait(...)` implies that the migrations are allowed and expected (thus the asynchronous `completion`.) Asynchronously adds to the stack an SQLite store from the given SQLite file URL. Note that using `addSQLiteStore(...)` instead of `addSQLiteStoreAndWait(...)` implies that the migrations are allowed and expected (thus the asynchronous `completion`.)
- parameter fileURL: the local file URL for the SQLite persistent store. A new SQLite file will be created if it does not exist. If not specified, defaults to a file URL pointing to a "<Application name>.sqlite" file in the "Application Support" directory. Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them. - parameter fileURL: the local file URL for the SQLite persistent store. A new SQLite file will be created if it does not exist. If not specified, defaults to a file URL pointing to a "<Application name>.sqlite" file in the "Application Support" directory (or the "Caches" directory on tvOS). Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them.
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them.
- parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.allBundles()`. - parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.allBundles()`.
- parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to report failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false. - parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to report failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false.
@@ -233,7 +233,7 @@ public extension DataStack {
/** /**
Migrates an SQLite store with the specified filename to the `DataStack`'s managed object model version WITHOUT adding the migrated store to the data stack. Migrates an SQLite store with the specified filename to the `DataStack`'s managed object model version WITHOUT adding the migrated store to the data stack.
- parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory. - parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory (or the "Caches" directory on tvOS).
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil` which indicates the "Default" configuration. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil` which indicates the "Default" configuration.
- parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`. - parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`.
- parameter sourceBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`. - parameter sourceBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`.
@@ -242,7 +242,7 @@ public extension DataStack {
public func upgradeSQLiteStoreIfNeeded(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle]? = nil, completion: (MigrationResult) -> Void) throws -> NSProgress? { public func upgradeSQLiteStoreIfNeeded(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle]? = nil, completion: (MigrationResult) -> Void) throws -> NSProgress? {
return try self.upgradeSQLiteStoreIfNeeded( return try self.upgradeSQLiteStoreIfNeeded(
fileURL: applicationSupportDirectory.URLByAppendingPathComponent( fileURL: defaultDirectory.URLByAppendingPathComponent(
fileName, fileName,
isDirectory: false isDirectory: false
), ),
@@ -255,7 +255,7 @@ public extension DataStack {
/** /**
Migrates an SQLite store at the specified file URL and configuration name to the `DataStack`'s managed object model version. This method does NOT add the migrated store to the data stack. Migrates an SQLite store at the specified file URL and configuration name to the `DataStack`'s managed object model version. This method does NOT add the migrated store to the data stack.
- parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory. - parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory (or the "Caches" directory on tvOS).
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil` which indicates the "Default" configuration. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil` which indicates the "Default" configuration.
- parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`. - parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`.
- parameter sourceBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`. - parameter sourceBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.mainBundle()`.
@@ -293,7 +293,7 @@ public extension DataStack {
/** /**
Checks for the required migrations needed for the store with the specified filename and configuration to be migrated to the `DataStack`'s managed object model version. This method throws an error if the store does not exist, if inspection of the store failed, or no mapping model was found/inferred. Checks for the required migrations needed for the store with the specified filename and configuration to be migrated to the `DataStack`'s managed object model version. This method throws an error if the store does not exist, if inspection of the store failed, or no mapping model was found/inferred.
- parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory. - parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory (or the "Caches" directory on tvOS).
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil` which indicates the "Default" configuration. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil` which indicates the "Default" configuration.
- parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.allBundles()`. - parameter mappingModelBundles: an optional array of bundles to search mapping model files from. If not set, defaults to the `NSBundle.allBundles()`.
:return: an array of `MigrationType`s indicating the chain of migrations required for the store; or `nil` if either inspection of the store failed, or no mapping model was found/inferred. `MigrationType` acts as a `Bool` and evaluates to `false` if no migration is required, and `true` if either a lightweight or custom migration is needed. :return: an array of `MigrationType`s indicating the chain of migrations required for the store; or `nil` if either inspection of the store failed, or no mapping model was found/inferred. `MigrationType` acts as a `Bool` and evaluates to `false` if no migration is required, and `true` if either a lightweight or custom migration is needed.
@@ -302,7 +302,7 @@ public extension DataStack {
public func requiredMigrationsForSQLiteStore(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle] = NSBundle.allBundles() as [NSBundle]) throws -> [MigrationType] { public func requiredMigrationsForSQLiteStore(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle] = NSBundle.allBundles() as [NSBundle]) throws -> [MigrationType] {
return try requiredMigrationsForSQLiteStore( return try requiredMigrationsForSQLiteStore(
fileURL: applicationSupportDirectory.URLByAppendingPathComponent( fileURL: defaultDirectory.URLByAppendingPathComponent(
fileName, fileName,
isDirectory: false isDirectory: false
), ),
+21 -21
View File
@@ -2,7 +2,7 @@
// MigrationChain.swift // MigrationChain.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,36 +30,36 @@ import CoreData
// MARK: - MigrationChain // MARK: - MigrationChain
/** /**
A `MigrationChain` indicates the sequence of model versions to be used as the order for incremental migration. This is typically passed to the `DataStack` initializer and will be applied to all stores added to the `DataStack` with `addSQLiteStore(...)` and its variants. A `MigrationChain` indicates the sequence of model versions to be used as the order for progressive migrations. This is typically passed to the `DataStack` initializer and will be applied to all stores added to the `DataStack` with `addSQLiteStore(...)` and its variants.
Initializing with empty values (either `nil`, `[]`, or `[:]`) instructs the `DataStack` to use the .xcdatamodel's current version as the final version, and to disable incremental migrations:
Initializing with empty values (either `nil`, `[]`, or `[:]`) instructs the `DataStack` to use the .xcdatamodel's current version as the final version, and to disable progressive migrations:
```
let dataStack = DataStack(migrationChain: nil) let dataStack = DataStack(migrationChain: nil)
```
This means that the mapping model will be computed from the store's version straight to the `DataStack`'s model version. This means that the mapping model will be computed from the store's version straight to the `DataStack`'s model version.
To support incremental migrations, specify the linear order of versions: To support progressive migrations, specify the linear order of versions:
```
let dataStack = DataStack(migrationChain: let dataStack = DataStack(migrationChain:
["MyAppModel", "MyAppModelV2", "MyAppModelV3", "MyAppModelV4"]) ["MyAppModel", "MyAppModelV2", "MyAppModelV3", "MyAppModelV4"])
```
or for more complex migration paths, a version tree that maps the key-values to the source-destination versions: or for more complex migration paths, a version tree that maps the key-values to the source-destination versions:
```
let dataStack = DataStack(migrationChain: [ let dataStack = DataStack(migrationChain: [
"MyAppModel": "MyAppModelV3", "MyAppModel": "MyAppModelV3",
"MyAppModelV2": "MyAppModelV4", "MyAppModelV2": "MyAppModelV4",
"MyAppModelV3": "MyAppModelV4" "MyAppModelV3": "MyAppModelV4"
]) ])
```
This allows for different migration paths depending on the starting version. The example above resolves to the following paths:
- MyAppModel-MyAppModelV3-MyAppModelV4
- MyAppModelV2-MyAppModelV4
- MyAppModelV3-MyAppModelV4
This allows for different migration paths depending on the starting version. The example above resolves to the following paths: The `MigrationChain` is validated when passed to the `DataStack` and unless it is empty, will raise an assertion if any of the following conditions are met:
- MyAppModel-MyAppModelV3-MyAppModelV4 - a version appears twice in an array
- MyAppModelV2-MyAppModelV4 - a version appears twice as a key in a dictionary literal
- MyAppModelV3-MyAppModelV4 - a loop is found in any of the paths
*/
The `MigrationChain` is validated when passed to the `DataStack` and unless it is empty, will raise an assertion if any of the following conditions are met:
- a version appears twice in an array
- a version appears twice as a key in a dictionary literal
- a loop is found in any of the paths
*/
public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, DictionaryLiteralConvertible, ArrayLiteralConvertible { public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, DictionaryLiteralConvertible, ArrayLiteralConvertible {
// MARK: NilLiteralConvertible // MARK: NilLiteralConvertible
+10 -11
View File
@@ -2,7 +2,7 @@
// MigrationResult.swift // MigrationResult.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -29,9 +29,9 @@ import Foundation
// MARK: - MigrationResult // MARK: - MigrationResult
/** /**
The `MigrationResult` indicates the result of a migration. The `MigrationResult` indicates the result of a migration.
The `MigrationResult` can be treated as a boolean: The `MigrationResult` can be treated as a boolean:
```
CoreStore.upgradeSQLiteStoreIfNeeded { transaction in CoreStore.upgradeSQLiteStoreIfNeeded { transaction in
// ... // ...
let result = transaction.commit() let result = transaction.commit()
@@ -42,9 +42,9 @@ The `MigrationResult` can be treated as a boolean:
// failed // failed
} }
} }
```
or as an `enum`, where the resulting associated object can also be inspected: or as an `enum`, where the resulting associated object can also be inspected:
```
CoreStore.beginAsynchronous { transaction in CoreStore.beginAsynchronous { transaction in
// ... // ...
let result = transaction.commit() let result = transaction.commit()
@@ -55,12 +55,10 @@ or as an `enum`, where the resulting associated object can also be inspected:
// error is the NSError instance for the failure // error is the NSError instance for the failure
} }
} }
``` ```
*/ */
public enum MigrationResult { public enum MigrationResult {
// MARK: Public
/** /**
`MigrationResult.Success` indicates either the migration succeeded, or there were no migrations needed. The associated value is an array of `MigrationType`s reflecting the migration steps completed. `MigrationResult.Success` indicates either the migration succeeded, or there were no migrations needed. The associated value is an array of `MigrationType`s reflecting the migration steps completed.
*/ */
@@ -103,6 +101,7 @@ extension MigrationResult: BooleanType {
public var boolValue: Bool { public var boolValue: Bool {
switch self { switch self {
case .Success: return true case .Success: return true
case .Failure: return false case .Failure: return false
} }
+3 -5
View File
@@ -2,7 +2,7 @@
// MigrationType.swift // MigrationType.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -29,12 +29,10 @@ import Foundation
// MARK: - MigrationType // MARK: - MigrationType
/** /**
The `MigrationType` specifies the type of migration required for a store. The `MigrationType` specifies the type of migration required for a store.
*/ */
public enum MigrationType: BooleanType { public enum MigrationType: BooleanType {
// MARK: Public
/** /**
Indicates that the persistent store matches the latest model version and no migration is needed Indicates that the persistent store matches the latest model version and no migration is needed
*/ */
+9 -6
View File
@@ -2,7 +2,7 @@
// NSError+CoreStore.swift // NSError+CoreStore.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -26,14 +26,17 @@
import Foundation import Foundation
import CoreData import CoreData
// MARK: - CoreStoreError
/** /**
The `NSError` error domain for `CoreStore`. The `NSError` error domain for `CoreStore`.
*/ */
public let CoreStoreErrorDomain = "com.corestore.error" public let CoreStoreErrorDomain = "com.corestore.error"
/** /**
The `NSError` error codes for `CoreStoreErrorDomain`. The `NSError` error codes for `CoreStoreErrorDomain`.
*/ */
public enum CoreStoreErrorCode: Int { public enum CoreStoreErrorCode: Int {
/** /**
@@ -58,7 +61,7 @@ public enum CoreStoreErrorCode: Int {
} }
// MARK: - NSError+CoreStore // MARK: - NSError
public extension NSError { public extension NSError {
@@ -2,7 +2,7 @@
// CoreStore+Observing.swift // CoreStore+Observing.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -32,8 +32,6 @@ import CoreData
@available(OSX, unavailable) @available(OSX, unavailable)
public extension CoreStore { public extension CoreStore {
// MARK: Public
/** /**
Using the `defaultStack`, creates a `ObjectMonitor` for the specified `NSManagedObject`. Multiple `ObjectObserver`s may then register themselves to be notified when changes are made to the `NSManagedObject`. Using the `defaultStack`, creates a `ObjectMonitor` for the specified `NSManagedObject`. Multiple `ObjectObserver`s may then register themselves to be notified when changes are made to the `NSManagedObject`.
@@ -2,7 +2,7 @@
// DataStack+Observing.swift // DataStack+Observing.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -35,8 +35,6 @@ import CoreData
@available(OSX, unavailable) @available(OSX, unavailable)
public extension DataStack { public extension DataStack {
// MARK: Public
/** /**
Creates a `ObjectMonitor` for the specified `NSManagedObject`. Multiple `ObjectObserver`s may then register themselves to be notified when changes are made to the `NSManagedObject`. Creates a `ObjectMonitor` for the specified `NSManagedObject`. Multiple `ObjectObserver`s may then register themselves to be notified when changes are made to the `NSManagedObject`.
+203 -41
View File
@@ -2,7 +2,7 @@
// ListMonitor.swift // ListMonitor.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -33,26 +33,26 @@ import CoreData
// MARK: - ListMonitor // MARK: - ListMonitor
/** /**
The `ListMonitor` monitors changes to a list of `NSManagedObject` instances. Observers that implement the `ListObserver` protocol may then register themselves to the `ListMonitor`'s `addObserver(_:)` method: The `ListMonitor` monitors changes to a list of `NSManagedObject` instances. Observers that implement the `ListObserver` protocol may then register themselves to the `ListMonitor`'s `addObserver(_:)` method:
```
let monitor = CoreStore.monitorList( let monitor = CoreStore.monitorList(
From(MyPersonEntity), From(MyPersonEntity),
Where("title", isEqualTo: "Engineer"), Where("title", isEqualTo: "Engineer"),
OrderBy(.Ascending("lastName")) OrderBy(.Ascending("lastName"))
) )
monitor.addObserver(self) monitor.addObserver(self)
```
The `ListMonitor` instance needs to be held on (retained) for as long as the list needs to be observed.
Observers registered via `addObserver(_:)` are not retained. `ListMonitor` only keeps a `weak` reference to all observers, thus keeping itself free from retain-cycles.
The `ListMonitor` instance needs to be held on (retained) for as long as the list needs to be observed. Lists created with `monitorList(...)` keep a single-section list of objects, where each object can be accessed by index:
Observers registered via `addObserver(_:)` are not retained. `ListMonitor` only keeps a `weak` reference to all observers, thus keeping itself free from retain-cycles. ```
Lists created with `monitorList(...)` keep a single-section list of objects, where each object can be accessed by index:
let firstPerson: MyPersonEntity = monitor[0] let firstPerson: MyPersonEntity = monitor[0]
```
Accessing the list with an index above the valid range will throw an exception.
Accessing the list with an index above the valid range will throw an exception. Creating a sectioned-list is also possible with the `monitorSectionedList(...)` method:
```
Creating a sectioned-list is also possible with the `monitorSectionedList(...)` method:
let monitor = CoreStore.monitorSectionedList( let monitor = CoreStore.monitorSectionedList(
From(MyPersonEntity), From(MyPersonEntity),
SectionBy("age") { "Age \($0)" }, SectionBy("age") { "Age \($0)" },
@@ -60,15 +60,15 @@ Creating a sectioned-list is also possible with the `monitorSectionedList(...)`
OrderBy(.Ascending("lastName")) OrderBy(.Ascending("lastName"))
) )
monitor.addObserver(self) monitor.addObserver(self)
```
Objects from `ListMonitor`s created this way can be accessed either by an `NSIndexPath` or a tuple: Objects from `ListMonitor`s created this way can be accessed either by an `NSIndexPath` or a tuple:
```
let indexPath = NSIndexPath(forItem: 3, inSection: 2) let indexPath = NSIndexPath(forItem: 3, inSection: 2)
let person1 = monitor[indexPath] let person1 = monitor[indexPath]
let person2 = monitor[2, 3] let person2 = monitor[2, 3]
```
In the example above, both `person1` and `person2` will contain the object at section=2, index=3. In the example above, both `person1` and `person2` will contain the object at section=2, index=3.
*/ */
@available(OSX, unavailable) @available(OSX, unavailable)
public final class ListMonitor<T: NSManagedObject> { public final class ListMonitor<T: NSManagedObject> {
@@ -335,6 +335,56 @@ public final class ListMonitor<T: NSManagedObject> {
return sections[section] return sections[section]
} }
/**
Returns the `NSFetchedResultsSectionInfo`s for all sections
- returns: the `NSFetchedResultsSectionInfo`s for all sections
*/
@warn_unused_result
public func sections() -> [NSFetchedResultsSectionInfo] {
CoreStore.assert(
!self.isPendingRefetch || NSThread.isMainThread(),
"Attempted to access a \(typeName(self)) outside the main thread while a refetch is in progress."
)
return self.fetchedResultsController.sections ?? []
}
/**
Returns the target section for a specified "Section Index" title and index.
- parameter title: the title of the Section Index
- parameter index: the index of the Section Index
- returns: the target section for the specified "Section Index" title and index.
*/
@warn_unused_result
public func targetSectionForSectionIndex(title title: String, index: Int) -> Int {
CoreStore.assert(
!self.isPendingRefetch || NSThread.isMainThread(),
"Attempted to access a \(typeName(self)) outside the main thread while a refetch is in progress."
)
return self.fetchedResultsController.sectionForSectionIndexTitle(title, atIndex: index)
}
/**
Returns the section index titles for all sections
- returns: the section index titles for all sections
*/
@warn_unused_result
public func sectionIndexTitles() -> [String] {
CoreStore.assert(
!self.isPendingRefetch || NSThread.isMainThread(),
"Attempted to access a \(typeName(self)) outside the main thread while a refetch is in progress."
)
return self.fetchedResultsController.sectionIndexTitles
}
/** /**
Returns the index of the `NSManagedObject` if it exists in the `ListMonitor`'s fetched objects, or `nil` if not found. Returns the index of the `NSManagedObject` if it exists in the `ListMonitor`'s fetched objects, or `nil` if not found.
@@ -832,12 +882,15 @@ public final class ListMonitor<T: NSManagedObject> {
"Attempted to refetch a \(typeName(self)) outside the main thread." "Attempted to refetch a \(typeName(self)) outside the main thread."
) )
if !self.isPendingRefetch {
self.isPendingRefetch = true self.isPendingRefetch = true
NSNotificationCenter.defaultCenter().postNotificationName( NSNotificationCenter.defaultCenter().postNotificationName(
ListMonitorWillRefetchListNotification, ListMonitorWillRefetchListNotification,
object: self object: self
) )
}
self.taskGroup.notify(.Main) { [weak self] () -> Void in self.taskGroup.notify(.Main) { [weak self] () -> Void in
@@ -854,14 +907,14 @@ public final class ListMonitor<T: NSManagedObject> {
clause.applyToFetchRequest(fetchRequest) clause.applyToFetchRequest(fetchRequest)
} }
strongSelf.parentStack?.childTransactionQueue.async { strongSelf.transactionQueue.async {
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }
try! strongSelf.fetchedResultsController.performFetch() try! strongSelf.fetchedResultsController.performFetchFromSpecifiedStores()
GCDQueue.Main.async { () -> Void in GCDQueue.Main.async { () -> Void in
@@ -888,36 +941,54 @@ public final class ListMonitor<T: NSManagedObject> {
internal convenience init(dataStack: DataStack, from: From<T>, sectionBy: SectionBy?, fetchClauses: [FetchClause]) { internal convenience init(dataStack: DataStack, from: From<T>, sectionBy: SectionBy?, fetchClauses: [FetchClause]) {
self.init( self.init(
dataStack: dataStack, context: dataStack.mainContext,
transactionQueue: dataStack.childTransactionQueue,
from: from, from: from,
sectionBy: sectionBy, sectionBy: sectionBy,
fetchClauses: fetchClauses, fetchClauses: fetchClauses,
prepareFetch: { _, performFetch in performFetch() } createAsynchronously: nil
) )
} }
internal convenience init(dataStack: DataStack, from: From<T>, sectionBy: SectionBy?, fetchClauses: [FetchClause], createAsynchronously: (ListMonitor<T>) -> Void) { internal convenience init(dataStack: DataStack, from: From<T>, sectionBy: SectionBy?, fetchClauses: [FetchClause], createAsynchronously: (ListMonitor<T>) -> Void) {
let queue = dataStack.childTransactionQueue
self.init( self.init(
dataStack: dataStack, context: dataStack.mainContext,
transactionQueue: queue,
from: from, from: from,
sectionBy: sectionBy, sectionBy: sectionBy,
fetchClauses: fetchClauses, fetchClauses: fetchClauses,
prepareFetch: { listMonitor, performFetch in createAsynchronously: createAsynchronously
dataStack.childTransactionQueue.async {
performFetch()
GCDQueue.Main.async {
createAsynchronously(listMonitor)
}
}
}
) )
} }
private init(dataStack: DataStack, from: From<T>, sectionBy: SectionBy?, fetchClauses: [FetchClause], prepareFetch: (ListMonitor<T>, () -> Void) -> Void) { internal convenience init(unsafeTransaction: UnsafeDataTransaction, from: From<T>, sectionBy: SectionBy?, fetchClauses: [FetchClause]) {
self.init(
context: unsafeTransaction.context,
transactionQueue: unsafeTransaction.transactionQueue,
from: from,
sectionBy: sectionBy,
fetchClauses: fetchClauses,
createAsynchronously: nil
)
}
internal convenience init(unsafeTransaction: UnsafeDataTransaction, from: From<T>, sectionBy: SectionBy?, fetchClauses: [FetchClause], createAsynchronously: (ListMonitor<T>) -> Void) {
let queue = unsafeTransaction.transactionQueue
self.init(
context: unsafeTransaction.context,
transactionQueue: queue,
from: from,
sectionBy: sectionBy,
fetchClauses: fetchClauses,
createAsynchronously: createAsynchronously
)
}
private init(context: NSManagedObjectContext, transactionQueue: GCDQueue, from: From<T>, sectionBy: SectionBy?, fetchClauses: [FetchClause], createAsynchronously: ((ListMonitor<T>) -> Void)?) {
let fetchRequest = NSFetchRequest() let fetchRequest = NSFetchRequest()
fetchRequest.fetchLimit = 0 fetchRequest.fetchLimit = 0
@@ -926,8 +997,8 @@ public final class ListMonitor<T: NSManagedObject> {
fetchRequest.includesPendingChanges = false fetchRequest.includesPendingChanges = false
fetchRequest.shouldRefreshRefetchedObjects = true fetchRequest.shouldRefreshRefetchedObjects = true
let fetchedResultsController = NSFetchedResultsController( let fetchedResultsController = CoreStoreFetchedResultsController<T>(
dataStack: dataStack, context: context,
fetchRequest: fetchRequest, fetchRequest: fetchRequest,
from: from, from: from,
sectionBy: sectionBy, sectionBy: sectionBy,
@@ -938,7 +1009,6 @@ public final class ListMonitor<T: NSManagedObject> {
self.fetchedResultsController = fetchedResultsController self.fetchedResultsController = fetchedResultsController
self.fetchedResultsControllerDelegate = fetchedResultsControllerDelegate self.fetchedResultsControllerDelegate = fetchedResultsControllerDelegate
self.parentStack = dataStack
if let sectionIndexTransformer = sectionBy?.sectionIndexTransformer { if let sectionIndexTransformer = sectionBy?.sectionIndexTransformer {
@@ -948,26 +1018,118 @@ public final class ListMonitor<T: NSManagedObject> {
self.sectionIndexTransformer = { $0 } self.sectionIndexTransformer = { $0 }
} }
self.transactionQueue = transactionQueue
fetchedResultsControllerDelegate.handler = self fetchedResultsControllerDelegate.handler = self
fetchedResultsControllerDelegate.fetchedResultsController = fetchedResultsController fetchedResultsControllerDelegate.fetchedResultsController = fetchedResultsController
prepareFetch(self, { try! fetchedResultsController.performFetch() }) guard let coordinator = context.parentStack?.coordinator else {
return
}
self.observerForWillChangePersistentStore = NotificationObserver(
notificationName: NSPersistentStoreCoordinatorStoresWillChangeNotification,
object: coordinator,
closure: { [weak self] (note) -> Void in
guard let `self` = self else {
return
}
self.isPersistentStoreChanging = true
guard let removedStores = (note.userInfo?[NSRemovedPersistentStoresKey] as? [NSPersistentStore]).flatMap(Set.init)
where !Set(self.fetchedResultsController.fetchRequest.affectedStores ?? []).intersect(removedStores).isEmpty else {
return
}
self.refetch(fetchClauses)
}
)
self.observerForDidChangePersistentStore = NotificationObserver(
notificationName: NSPersistentStoreCoordinatorStoresDidChangeNotification,
object: coordinator,
closure: { [weak self] (note) -> Void in
guard let `self` = self else {
return
}
if !self.isPendingRefetch {
let previousStores = Set(self.fetchedResultsController.fetchRequest.affectedStores ?? [])
let currentStores = previousStores
.subtract(note.userInfo?[NSRemovedPersistentStoresKey] as? [NSPersistentStore] ?? [])
.union(note.userInfo?[NSAddedPersistentStoresKey] as? [NSPersistentStore] ?? [])
if previousStores != currentStores {
self.refetch(fetchClauses)
}
}
self.isPersistentStoreChanging = false
}
)
if let createAsynchronously = createAsynchronously {
transactionQueue.async {
try! fetchedResultsController.performFetchFromSpecifiedStores()
self.taskGroup.notify(.Main) {
createAsynchronously(self)
}
}
}
else {
try! fetchedResultsController.performFetchFromSpecifiedStores()
}
} }
deinit { deinit {
self.fetchedResultsControllerDelegate.fetchedResultsController = nil self.fetchedResultsControllerDelegate.fetchedResultsController = nil
self.isPersistentStoreChanging = false
}
private var isPersistentStoreChanging: Bool = false {
didSet {
let newValue = self.isPersistentStoreChanging
guard newValue != oldValue else {
return
}
if newValue {
self.taskGroup.enter()
}
else {
self.taskGroup.leave()
}
}
} }
// MARK: Private // MARK: Private
private let fetchedResultsController: NSFetchedResultsController private let fetchedResultsController: CoreStoreFetchedResultsController<T>
private let fetchedResultsControllerDelegate: FetchedResultsControllerDelegate private let fetchedResultsControllerDelegate: FetchedResultsControllerDelegate
private let sectionIndexTransformer: (sectionName: KeyPath?) -> String? private let sectionIndexTransformer: (sectionName: KeyPath?) -> String?
private var observerForWillChangePersistentStore: NotificationObserver!
private var observerForDidChangePersistentStore: NotificationObserver!
private let taskGroup = GCDGroup() private let taskGroup = GCDGroup()
private weak var parentStack: DataStack? private let transactionQueue: GCDQueue
private var willChangeListKey: Void? private var willChangeListKey: Void?
private var didChangeListKey: Void? private var didChangeListKey: Void?
+13 -10
View File
@@ -2,7 +2,7 @@
// ListObserver.swift // ListObserver.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,14 +30,15 @@ import CoreData
// MARK: - ListObserver // MARK: - ListObserver
/** /**
Implement the `ListObserver` protocol to observe changes to a list of `NSManagedObject`s. `ListObserver`s may register themselves to a `ListMonitor`'s `addObserver(_:)` method: Implement the `ListObserver` protocol to observe changes to a list of `NSManagedObject`s. `ListObserver`s may register themselves to a `ListMonitor`'s `addObserver(_:)` method:
```
let monitor = CoreStore.monitorList( let monitor = CoreStore.monitorList(
From(MyPersonEntity), From(MyPersonEntity),
OrderBy(.Ascending("lastName")) OrderBy(.Ascending("lastName"))
) )
monitor.addObserver(self) monitor.addObserver(self)
*/ ```
*/
@available(OSX, unavailable) @available(OSX, unavailable)
public protocol ListObserver: class { public protocol ListObserver: class {
@@ -106,14 +107,15 @@ public extension ListObserver {
// MARK: - ListObjectObserver // MARK: - ListObjectObserver
/** /**
Implement the `ListObjectObserver` protocol to observe detailed changes to a list's object. `ListObjectObserver`s may register themselves to a `ListMonitor`'s `addObserver(_:)` method: Implement the `ListObjectObserver` protocol to observe detailed changes to a list's object. `ListObjectObserver`s may register themselves to a `ListMonitor`'s `addObserver(_:)` method:
```
let monitor = CoreStore.monitorList( let monitor = CoreStore.monitorList(
From(MyPersonEntity), From(MyPersonEntity),
OrderBy(.Ascending("lastName")) OrderBy(.Ascending("lastName"))
) )
monitor.addObserver(self) monitor.addObserver(self)
*/ ```
*/
@available(OSX, unavailable) @available(OSX, unavailable)
public protocol ListObjectObserver: ListObserver { public protocol ListObjectObserver: ListObserver {
@@ -186,15 +188,16 @@ public extension ListObjectObserver {
// MARK: - ListSectionObserver // MARK: - ListSectionObserver
/** /**
Implement the `ListSectionObserver` protocol to observe changes to a list's section info. `ListSectionObserver`s may register themselves to a `ListMonitor`'s `addObserver(_:)` method: Implement the `ListSectionObserver` protocol to observe changes to a list's section info. `ListSectionObserver`s may register themselves to a `ListMonitor`'s `addObserver(_:)` method:
```
let monitor = CoreStore.monitorSectionedList( let monitor = CoreStore.monitorSectionedList(
From(MyPersonEntity), From(MyPersonEntity),
SectionBy("age") { "Age \($0)" }, SectionBy("age") { "Age \($0)" },
OrderBy(.Ascending("lastName")) OrderBy(.Ascending("lastName"))
) )
monitor.addObserver(self) monitor.addObserver(self)
*/ ```
*/
@available(OSX, unavailable) @available(OSX, unavailable)
public protocol ListSectionObserver: ListObjectObserver { public protocol ListSectionObserver: ListObjectObserver {
+22 -16
View File
@@ -2,7 +2,7 @@
// ObjectMonitor.swift // ObjectMonitor.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -33,20 +33,18 @@ import CoreData
// MARK: - ObjectMonitor // MARK: - ObjectMonitor
/** /**
The `ObjectMonitor` monitors changes to a single `NSManagedObject` instance. Observers that implement the `ObjectObserver` protocol may then register themselves to the `ObjectMonitor`'s `addObserver(_:)` method: The `ObjectMonitor` monitors changes to a single `NSManagedObject` instance. Observers that implement the `ObjectObserver` protocol may then register themselves to the `ObjectMonitor`'s `addObserver(_:)` method:
```
let monitor = CoreStore.monitorObject(object) let monitor = CoreStore.monitorObject(object)
monitor.addObserver(self) monitor.addObserver(self)
```
The created `ObjectMonitor` instance needs to be held on (retained) for as long as the object needs to be observed.
The created `ObjectMonitor` instance needs to be held on (retained) for as long as the object needs to be observed. Observers registered via `addObserver(_:)` are not retained. `ObjectMonitor` only keeps a `weak` reference to all observers, thus keeping itself free from retain-cycles.
*/
Observers registered via `addObserver(_:)` are not retained. `ObjectMonitor` only keeps a `weak` reference to all observers, thus keeping itself free from retain-cycles.
*/
@available(OSX, unavailable) @available(OSX, unavailable)
public final class ObjectMonitor<T: NSManagedObject> { public final class ObjectMonitor<T: NSManagedObject> {
// MARK: Public
/** /**
Returns the `NSManagedObject` instance being observed, or `nil` if the object was already deleted. Returns the `NSManagedObject` instance being observed, or `nil` if the object was already deleted.
*/ */
@@ -165,7 +163,17 @@ public final class ObjectMonitor<T: NSManagedObject> {
// MARK: Internal // MARK: Internal
internal init(dataStack: DataStack, object: T) { internal convenience init(dataStack: DataStack, object: T) {
self.init(context: dataStack.mainContext, object: object)
}
internal convenience init(unsafeTransaction: UnsafeDataTransaction, object: T) {
self.init(context: unsafeTransaction.context, object: object)
}
private init(context: NSManagedObjectContext, object: T) {
let fetchRequest = NSFetchRequest() let fetchRequest = NSFetchRequest()
fetchRequest.entity = object.entity fetchRequest.entity = object.entity
@@ -175,8 +183,8 @@ public final class ObjectMonitor<T: NSManagedObject> {
fetchRequest.includesPendingChanges = false fetchRequest.includesPendingChanges = false
fetchRequest.shouldRefreshRefetchedObjects = true fetchRequest.shouldRefreshRefetchedObjects = true
let fetchedResultsController = NSFetchedResultsController( let fetchedResultsController = CoreStoreFetchedResultsController<T>(
dataStack: dataStack, context: context,
fetchRequest: fetchRequest, fetchRequest: fetchRequest,
fetchClauses: [Where("SELF", isEqualTo: object.objectID)] fetchClauses: [Where("SELF", isEqualTo: object.objectID)]
) )
@@ -185,11 +193,10 @@ public final class ObjectMonitor<T: NSManagedObject> {
self.fetchedResultsController = fetchedResultsController self.fetchedResultsController = fetchedResultsController
self.fetchedResultsControllerDelegate = fetchedResultsControllerDelegate self.fetchedResultsControllerDelegate = fetchedResultsControllerDelegate
self.parentStack = dataStack
fetchedResultsControllerDelegate.handler = self fetchedResultsControllerDelegate.handler = self
fetchedResultsControllerDelegate.fetchedResultsController = fetchedResultsController fetchedResultsControllerDelegate.fetchedResultsController = fetchedResultsController
try! fetchedResultsController.performFetch() try! fetchedResultsController.performFetchFromSpecifiedStores()
self.lastCommittedAttributes = (self.object?.committedValuesForKeys(nil) as? [String: NSObject]) ?? [:] self.lastCommittedAttributes = (self.object?.committedValuesForKeys(nil) as? [String: NSObject]) ?? [:]
} }
@@ -202,10 +209,9 @@ public final class ObjectMonitor<T: NSManagedObject> {
// MARK: Private // MARK: Private
private let fetchedResultsController: NSFetchedResultsController private let fetchedResultsController: CoreStoreFetchedResultsController<T>
private let fetchedResultsControllerDelegate: FetchedResultsControllerDelegate private let fetchedResultsControllerDelegate: FetchedResultsControllerDelegate
private var lastCommittedAttributes = [String: NSObject]() private var lastCommittedAttributes = [String: NSObject]()
private weak var parentStack: DataStack?
private var willChangeObjectKey: Void? private var willChangeObjectKey: Void?
private var didDeleteObjectKey: Void? private var didDeleteObjectKey: Void?
+5 -4
View File
@@ -2,7 +2,7 @@
// ObjectObserver.swift // ObjectObserver.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,11 +30,12 @@ import CoreData
// MARK: - ObjectObserver // MARK: - ObjectObserver
/** /**
Implement the `ObjectObserver` protocol to observe changes to a single `NSManagedObject` instance. `ObjectObserver`s may register themselves to a `ObjectMonitor`'s `addObserver(_:)` method: Implement the `ObjectObserver` protocol to observe changes to a single `NSManagedObject` instance. `ObjectObserver`s may register themselves to a `ObjectMonitor`'s `addObserver(_:)` method:
```
let monitor = CoreStore.monitorObject(object) let monitor = CoreStore.monitorObject(object)
monitor.addObserver(self) monitor.addObserver(self)
*/ ```
*/
@available(OSX, unavailable) @available(OSX, unavailable)
public protocol ObjectObserver: class { public protocol ObjectObserver: class {
+5 -6
View File
@@ -2,7 +2,7 @@
// SectionBy.swift // SectionBy.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,19 +30,18 @@ import CoreData
// MARK: - SectionBy // MARK: - SectionBy
/** /**
The `SectionBy` clause indicates the key path to use to group the `ListMonitor` objects into sections. An optional closure can also be provided to transform the value into an appropriate section name: The `SectionBy` clause indicates the key path to use to group the `ListMonitor` objects into sections. An optional closure can also be provided to transform the value into an appropriate section name:
```
let monitor = CoreStore.monitorSectionedList( let monitor = CoreStore.monitorSectionedList(
From(MyPersonEntity), From(MyPersonEntity),
SectionBy("age") { "Age \($0)" }, SectionBy("age") { "Age \($0)" },
OrderBy(.Ascending("lastName")) OrderBy(.Ascending("lastName"))
) )
*/ ```
*/
@available(OSX, unavailable) @available(OSX, unavailable)
public struct SectionBy { public struct SectionBy {
// MARK: Public
/** /**
Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections Initializes a `SectionBy` clause with the key path to use to group `ListMonitor` objects into sections
@@ -0,0 +1,198 @@
//
// UnsafeDataTransaction+Observing.swift
// CoreStore
//
// Copyright © 2016 John Rommel Estropia
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
import Foundation
import CoreData
#if USE_FRAMEWORKS
import GCDKit
#endif
// MARK: - UnsafeDataTransaction
@available(OSX, unavailable)
public extension UnsafeDataTransaction {
/**
Creates a `ObjectMonitor` for the specified `NSManagedObject`. Multiple `ObjectObserver`s may then register themselves to be notified when changes are made to the `NSManagedObject`.
- parameter object: the `NSManagedObject` to observe changes from
- returns: a `ObjectMonitor` that monitors changes to `object`
*/
@warn_unused_result
public func monitorObject<T: NSManagedObject>(object: T) -> ObjectMonitor<T> {
return ObjectMonitor(
unsafeTransaction: self,
object: object
)
}
/**
Creates a `ListMonitor` for a list of `NSManagedObject`s that satisfy the specified fetch clauses. Multiple `ListObserver`s may then register themselves to be notified when changes are made to the list.
- parameter from: a `From` clause indicating the entity type
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: a `ListMonitor` instance that monitors changes to the list
*/
@warn_unused_result
public func monitorList<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> ListMonitor<T> {
return self.monitorList(from, fetchClauses)
}
/**
Creates a `ListMonitor` for a list of `NSManagedObject`s that satisfy the specified fetch clauses. Multiple `ListObserver`s may then register themselves to be notified when changes are made to the list.
- parameter from: a `From` clause indicating the entity type
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: a `ListMonitor` instance that monitors changes to the list
*/
@warn_unused_result
public func monitorList<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> ListMonitor<T> {
CoreStore.assert(
fetchClauses.filter { $0 is OrderBy }.count > 0,
"A ListMonitor requires an OrderBy clause."
)
return ListMonitor(
unsafeTransaction: self,
from: from,
sectionBy: nil,
fetchClauses: fetchClauses
)
}
/**
Asynchronously creates a `ListMonitor` for a list of `NSManagedObject`s that satisfy the specified fetch clauses. Multiple `ListObserver`s may then register themselves to be notified when changes are made to the list. Since `NSFetchedResultsController` greedily locks the persistent store on initial fetch, you may prefer this method instead of the synchronous counterpart to avoid deadlocks while background updates/saves are being executed.
- parameter createAsynchronously: the closure that receives the created `ListMonitor` instance
- parameter from: a `From` clause indicating the entity type
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
public func monitorList<T: NSManagedObject>(createAsynchronously createAsynchronously: (ListMonitor<T>) -> Void, _ from: From<T>, _ fetchClauses: FetchClause...) {
self.monitorList(createAsynchronously: createAsynchronously, from, fetchClauses)
}
/**
Asynchronously creates a `ListMonitor` for a list of `NSManagedObject`s that satisfy the specified fetch clauses. Multiple `ListObserver`s may then register themselves to be notified when changes are made to the list. Since `NSFetchedResultsController` greedily locks the persistent store on initial fetch, you may prefer this method instead of the synchronous counterpart to avoid deadlocks while background updates/saves are being executed.
- parameter createAsynchronously: the closure that receives the created `ListMonitor` instance
- parameter from: a `From` clause indicating the entity type
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
public func monitorList<T: NSManagedObject>(createAsynchronously createAsynchronously: (ListMonitor<T>) -> Void, _ from: From<T>, _ fetchClauses: [FetchClause]) {
CoreStore.assert(
fetchClauses.filter { $0 is OrderBy }.count > 0,
"A ListMonitor requires an OrderBy clause."
)
_ = ListMonitor(
unsafeTransaction: self,
from: from,
sectionBy: nil,
fetchClauses: fetchClauses,
createAsynchronously: createAsynchronously
)
}
/**
Creates a `ListMonitor` for a sectioned list of `NSManagedObject`s that satisfy the specified fetch clauses. Multiple `ListObserver`s may then register themselves to be notified when changes are made to the list.
- parameter from: a `From` clause indicating the entity type
- parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections.
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: a `ListMonitor` instance that monitors changes to the list
*/
@warn_unused_result
public func monitorSectionedList<T: NSManagedObject>(from: From<T>, _ sectionBy: SectionBy, _ fetchClauses: FetchClause...) -> ListMonitor<T> {
return self.monitorSectionedList(from, sectionBy, fetchClauses)
}
/**
Creates a `ListMonitor` for a sectioned list of `NSManagedObject`s that satisfy the specified fetch clauses. Multiple `ListObserver`s may then register themselves to be notified when changes are made to the list.
- parameter from: a `From` clause indicating the entity type
- parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections.
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: a `ListMonitor` instance that monitors changes to the list
*/
@warn_unused_result
public func monitorSectionedList<T: NSManagedObject>(from: From<T>, _ sectionBy: SectionBy, _ fetchClauses: [FetchClause]) -> ListMonitor<T> {
CoreStore.assert(
fetchClauses.filter { $0 is OrderBy }.count > 0,
"A ListMonitor requires an OrderBy clause."
)
return ListMonitor(
unsafeTransaction: self,
from: from,
sectionBy: sectionBy,
fetchClauses: fetchClauses
)
}
/**
Asynchronously creates a `ListMonitor` for a sectioned list of `NSManagedObject`s that satisfy the specified fetch clauses. Multiple `ListObserver`s may then register themselves to be notified when changes are made to the list. Since `NSFetchedResultsController` greedily locks the persistent store on initial fetch, you may prefer this method instead of the synchronous counterpart to avoid deadlocks while background updates/saves are being executed.
- parameter createAsynchronously: the closure that receives the created `ListMonitor` instance
- parameter from: a `From` clause indicating the entity type
- parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections.
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
public func monitorSectionedList<T: NSManagedObject>(createAsynchronously createAsynchronously: (ListMonitor<T>) -> Void, _ from: From<T>, _ sectionBy: SectionBy, _ fetchClauses: FetchClause...) {
self.monitorSectionedList(createAsynchronously: createAsynchronously, from, sectionBy, fetchClauses)
}
/**
Asynchronously creates a `ListMonitor` for a sectioned list of `NSManagedObject`s that satisfy the specified fetch clauses. Multiple `ListObserver`s may then register themselves to be notified when changes are made to the list. Since `NSFetchedResultsController` greedily locks the persistent store on initial fetch, you may prefer this method instead of the synchronous counterpart to avoid deadlocks while background updates/saves are being executed.
- parameter createAsynchronously: the closure that receives the created `ListMonitor` instance
- parameter from: a `From` clause indicating the entity type
- parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections.
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
public func monitorSectionedList<T: NSManagedObject>(createAsynchronously createAsynchronously: (ListMonitor<T>) -> Void, _ from: From<T>, _ sectionBy: SectionBy, _ fetchClauses: [FetchClause]) {
CoreStore.assert(
fetchClauses.filter { $0 is OrderBy }.count > 0,
"A ListMonitor requires an OrderBy clause."
)
_ = ListMonitor(
unsafeTransaction: self,
from: from,
sectionBy: sectionBy,
fetchClauses: fetchClauses,
createAsynchronously: createAsynchronously
)
}
}
@@ -2,7 +2,7 @@
// AsynchronousDataTransaction.swift // AsynchronousDataTransaction.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -33,12 +33,10 @@ import CoreData
// MARK: - AsynchronousDataTransaction // MARK: - AsynchronousDataTransaction
/** /**
The `AsynchronousDataTransaction` provides an interface for `NSManagedObject` creates, updates, and deletes. A transaction object should typically be only used from within a transaction block initiated from `DataStack.beginAsynchronous(_:)`, or from `CoreStore.beginAsynchronous(_:)`. The `AsynchronousDataTransaction` provides an interface for `NSManagedObject` creates, updates, and deletes. A transaction object should typically be only used from within a transaction block initiated from `DataStack.beginAsynchronous(_:)`, or from `CoreStore.beginAsynchronous(_:)`.
*/ */
public final class AsynchronousDataTransaction: BaseDataTransaction { public final class AsynchronousDataTransaction: BaseDataTransaction {
// MARK: Public
/** /**
Saves the transaction changes. This method should not be used after the `commit()` method was already called once. Saves the transaction changes. This method should not be used after the `commit()` method was already called once.
@@ -2,7 +2,7 @@
// BaseDataTransaction.swift // BaseDataTransaction.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -33,8 +33,8 @@ import CoreData
// MARK: - BaseDataTransaction // MARK: - BaseDataTransaction
/** /**
The `BaseDataTransaction` is an abstract interface for `NSManagedObject` creates, updates, and deletes. All `BaseDataTransaction` subclasses manage a private `NSManagedObjectContext` which are direct children of the `NSPersistentStoreCoordinator`'s root `NSManagedObjectContext`. This means that all updates are saved first to the persistent store, and then propagated up to the read-only `NSManagedObjectContext`. The `BaseDataTransaction` is an abstract interface for `NSManagedObject` creates, updates, and deletes. All `BaseDataTransaction` subclasses manage a private `NSManagedObjectContext` which are direct children of the `NSPersistentStoreCoordinator`'s root `NSManagedObjectContext`. This means that all updates are saved first to the persistent store, and then propagated up to the read-only `NSManagedObjectContext`.
*/ */
public /*abstract*/ class BaseDataTransaction { public /*abstract*/ class BaseDataTransaction {
// MARK: Object management // MARK: Object management
@@ -56,7 +56,7 @@ public /*abstract*/ class BaseDataTransaction {
public func create<T: NSManagedObject>(into: Into<T>) -> T { public func create<T: NSManagedObject>(into: Into<T>) -> T {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to create an entity of type \(typeName(T)) outside its designated queue." "Attempted to create an entity of type \(typeName(T)) outside its designated queue."
) )
@@ -110,7 +110,7 @@ public /*abstract*/ class BaseDataTransaction {
public func edit<T: NSManagedObject>(object: T?) -> T? { public func edit<T: NSManagedObject>(object: T?) -> T? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to update an entity of type \(typeName(object)) outside its designated queue." "Attempted to update an entity of type \(typeName(object)) outside its designated queue."
) )
guard let object = object else { guard let object = object else {
@@ -131,7 +131,7 @@ public /*abstract*/ class BaseDataTransaction {
public func edit<T: NSManagedObject>(into: Into<T>, _ objectID: NSManagedObjectID) -> T? { public func edit<T: NSManagedObject>(into: Into<T>, _ objectID: NSManagedObjectID) -> T? {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to update an entity of type \(typeName(T)) outside its designated queue." "Attempted to update an entity of type \(typeName(T)) outside its designated queue."
) )
CoreStore.assert( CoreStore.assert(
@@ -150,7 +150,7 @@ public /*abstract*/ class BaseDataTransaction {
public func delete(object: NSManagedObject?) { public func delete(object: NSManagedObject?) {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to delete an entity outside its designated queue." "Attempted to delete an entity outside its designated queue."
) )
guard let object = object else { guard let object = object else {
@@ -180,7 +180,7 @@ public /*abstract*/ class BaseDataTransaction {
public func delete<S: SequenceType where S.Generator.Element: NSManagedObject>(objects: S) { public func delete<S: SequenceType where S.Generator.Element: NSManagedObject>(objects: S) {
CoreStore.assert( CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(), self.isRunningInAllowedQueue(),
"Attempted to delete entities outside their designated queue." "Attempted to delete entities outside their designated queue."
) )
@@ -188,6 +188,257 @@ public /*abstract*/ class BaseDataTransaction {
objects.forEach { context.fetchExisting($0)?.deleteFromContext() } objects.forEach { context.fetchExisting($0)?.deleteFromContext() }
} }
/**
Refreshes all registered objects `NSManagedObject`s in the transaction.
*/
public func refreshAllObjectsAsFaults() {
CoreStore.assert(
self.isRunningInAllowedQueue(),
"Attempted to refresh entities outside their designated queue."
)
self.context.refreshAllObjectsAsFaults()
}
// MARK: Inspecting Pending Objects
/**
Returns all pending `NSManagedObject`s that were inserted to the transaction. This method should not be called after the `commit()` method was called.
- returns: a `Set` of pending `NSManagedObject`s that were inserted to the transaction.
*/
public func insertedObjects() -> Set<NSManagedObject> {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to access inserted objects from a \(typeName(self)) outside its designated queue."
)
CoreStore.assert(
!self.isCommitted,
"Attempted to access inserted objects from an already committed \(typeName(self))."
)
return self.context.insertedObjects
}
/**
Returns all pending `NSManagedObject`s of the specified type that were inserted to the transaction. This method should not be called after the `commit()` method was called.
- parameter entity: the `NSManagedObject` subclass to filter
- returns: a `Set` of pending `NSManagedObject`s of the specified type that were inserted to the transaction.
*/
public func insertedObjects<T: NSManagedObject>(entity: T.Type) -> Set<T> {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to access inserted objects from a \(typeName(self)) outside its designated queue."
)
CoreStore.assert(
!self.isCommitted,
"Attempted to access inserted objects from an already committed \(typeName(self))."
)
return Set(self.context.insertedObjects.flatMap { $0 as? T })
}
/**
Returns all pending `NSManagedObjectID`s that were inserted to the transaction. This method should not be called after the `commit()` method was called.
- returns: a `Set` of pending `NSManagedObjectID`s that were inserted to the transaction.
*/
public func insertedObjectIDs() -> Set<NSManagedObjectID> {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to access inserted object IDs from a \(typeName(self)) outside its designated queue."
)
CoreStore.assert(
!self.isCommitted,
"Attempted to access inserted objects IDs from an already committed \(typeName(self))."
)
return Set(self.context.insertedObjects.map { $0.objectID })
}
/**
Returns all pending `NSManagedObjectID`s of the specified type that were inserted to the transaction. This method should not be called after the `commit()` method was called.
- parameter entity: the `NSManagedObject` subclass to filter
- returns: a `Set` of pending `NSManagedObjectID`s of the specified type that were inserted to the transaction.
*/
public func insertedObjectIDs<T: NSManagedObject>(entity: T.Type) -> Set<NSManagedObjectID> {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to access inserted object IDs from a \(typeName(self)) outside its designated queue."
)
CoreStore.assert(
!self.isCommitted,
"Attempted to access inserted objects IDs from an already committed \(typeName(self))."
)
return Set(self.context.insertedObjects.flatMap { $0 as? T }.map { $0.objectID })
}
/**
Returns all pending `NSManagedObject`s that were updated in the transaction. This method should not be called after the `commit()` method was called.
- returns: a `Set` of pending `NSManagedObject`s that were updated to the transaction.
*/
public func updatedObjects() -> Set<NSManagedObject> {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to access updated objects from a \(typeName(self)) outside its designated queue."
)
CoreStore.assert(
!self.isCommitted,
"Attempted to access updated objects from an already committed \(typeName(self))."
)
return self.context.updatedObjects
}
/**
Returns all pending `NSManagedObject`s of the specified type that were updated in the transaction. This method should not be called after the `commit()` method was called.
- parameter entity: the `NSManagedObject` subclass to filter
- returns: a `Set` of pending `NSManagedObject`s of the specified type that were updated in the transaction.
*/
public func updatedObjects<T: NSManagedObject>(entity: T.Type) -> Set<T> {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to access updated objects from a \(typeName(self)) outside its designated queue."
)
CoreStore.assert(
!self.isCommitted,
"Attempted to access updated objects from an already committed \(typeName(self))."
)
return Set(self.context.updatedObjects.flatMap { $0 as? T })
}
/**
Returns all pending `NSManagedObjectID`s that were updated in the transaction. This method should not be called after the `commit()` method was called.
- returns: a `Set` of pending `NSManagedObjectID`s that were updated in the transaction.
*/
public func updatedObjectIDs() -> Set<NSManagedObjectID> {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to access updated object IDs from a \(typeName(self)) outside its designated queue."
)
CoreStore.assert(
!self.isCommitted,
"Attempted to access updated object IDs from an already committed \(typeName(self))."
)
return Set(self.context.updatedObjects.map { $0.objectID })
}
/**
Returns all pending `NSManagedObjectID`s of the specified type that were updated in the transaction. This method should not be called after the `commit()` method was called.
- parameter entity: the `NSManagedObject` subclass to filter
- returns: a `Set` of pending `NSManagedObjectID`s of the specified type that were updated in the transaction.
*/
public func updatedObjectIDs<T: NSManagedObject>(entity: T.Type) -> Set<NSManagedObjectID> {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to access updated object IDs from a \(typeName(self)) outside its designated queue."
)
CoreStore.assert(
!self.isCommitted,
"Attempted to access updated object IDs from an already committed \(typeName(self))."
)
return Set(self.context.updatedObjects.flatMap { $0 as? T }.map { $0.objectID })
}
/**
Returns all pending `NSManagedObject`s that were deleted from the transaction. This method should not be called after the `commit()` method was called.
- returns: a `Set` of pending `NSManagedObject`s that were deleted from the transaction.
*/
public func deletedObjects() -> Set<NSManagedObject> {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to access deleted objects from a \(typeName(self)) outside its designated queue."
)
CoreStore.assert(
!self.isCommitted,
"Attempted to access deleted objects from an already committed \(typeName(self))."
)
return self.context.deletedObjects
}
/**
Returns all pending `NSManagedObject`s of the specified type that were deleted from the transaction. This method should not be called after the `commit()` method was called.
- parameter entity: the `NSManagedObject` subclass to filter
- returns: a `Set` of pending `NSManagedObject`s of the specified type that were deleted from the transaction.
*/
public func deletedObjects<T: NSManagedObject>(entity: T.Type) -> Set<T> {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to access deleted objects from a \(typeName(self)) outside its designated queue."
)
CoreStore.assert(
!self.isCommitted,
"Attempted to access deleted objects from an already committed \(typeName(self))."
)
return Set(self.context.deletedObjects.flatMap { $0 as? T })
}
/**
Returns all pending `NSManagedObjectID`s of the specified type that were deleted from the transaction. This method should not be called after the `commit()` method was called.
- parameter entity: the `NSManagedObject` subclass to filter
- returns: a `Set` of pending `NSManagedObjectID`s of the specified type that were deleted from the transaction.
*/
public func deletedObjectIDs() -> Set<NSManagedObjectID> {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to access deleted object IDs from a \(typeName(self)) outside its designated queue."
)
CoreStore.assert(
!self.isCommitted,
"Attempted to access deleted object IDs from an already committed \(typeName(self))."
)
return Set(self.context.deletedObjects.map { $0.objectID })
}
/**
Returns all pending `NSManagedObjectID`s of the specified type that were deleted from the transaction. This method should not be called after the `commit()` method was called.
- parameter entity: the `NSManagedObject` subclass to filter
- returns: a `Set` of pending `NSManagedObjectID`s of the specified type that were deleted from the transaction.
*/
public func deletedObjectIDs<T: NSManagedObject>(entity: T.Type) -> Set<NSManagedObjectID> {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to access deleted object IDs from a \(typeName(self)) outside its designated queue."
)
CoreStore.assert(
!self.isCommitted,
"Attempted to access deleted object IDs from an already committed \(typeName(self))."
)
return Set(self.context.deletedObjects.flatMap { $0 as? T }.map { $0.objectID })
}
// MARK: Internal // MARK: Internal
@@ -223,4 +474,9 @@ public /*abstract*/ class BaseDataTransaction {
context.undoManager = NSUndoManager() context.undoManager = NSUndoManager()
} }
} }
internal func isRunningInAllowedQueue() -> Bool {
return self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext()
}
} }
@@ -2,7 +2,7 @@
// CoreStore+Transaction.swift // CoreStore+Transaction.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,8 +30,6 @@ import Foundation
public extension CoreStore { public extension CoreStore {
// MARK: Public
/** /**
Using the `defaultStack`, begins a transaction asynchronously where `NSManagedObject` creates, updates, and deletes can be made. Using the `defaultStack`, begins a transaction asynchronously where `NSManagedObject` creates, updates, and deletes can be made.
@@ -65,6 +63,14 @@ public extension CoreStore {
return self.defaultStack.beginUnsafe(supportsUndo: supportsUndo) return self.defaultStack.beginUnsafe(supportsUndo: supportsUndo)
} }
/**
Refreshes all registered objects `NSManagedObject`s in the `DataStack`.
*/
public static func refreshAllObjectsAsFaults() {
self.defaultStack.refreshAllObjectsAsFaults()
}
@available(*, deprecated=1.3.1, renamed="beginUnsafe") @available(*, deprecated=1.3.1, renamed="beginUnsafe")
@warn_unused_result @warn_unused_result
public static func beginDetached() -> UnsafeDataTransaction { public static func beginDetached() -> UnsafeDataTransaction {
@@ -2,7 +2,7 @@
// DataStack+Transaction.swift // DataStack+Transaction.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -34,8 +34,6 @@ import CoreData
public extension DataStack { public extension DataStack {
// MARK: Public
/** /**
Begins a transaction asynchronously where `NSManagedObject` creates, updates, and deletes can be made. Begins a transaction asynchronously where `NSManagedObject` creates, updates, and deletes can be made.
@@ -82,6 +80,19 @@ public extension DataStack {
) )
} }
/**
Refreshes all registered objects `NSManagedObject`s in the `DataStack`.
*/
public func refreshAllObjectsAsFaults() {
CoreStore.assert(
NSThread.isMainThread(),
"Attempted to refresh entities outside their designated queue."
)
self.mainContext.refreshAllObjectsAsFaults()
}
@available(*, deprecated=1.3.1, renamed="beginUnsafe") @available(*, deprecated=1.3.1, renamed="beginUnsafe")
@warn_unused_result @warn_unused_result
public func beginDetached() -> UnsafeDataTransaction { public func beginDetached() -> UnsafeDataTransaction {
+23 -22
View File
@@ -2,7 +2,7 @@
// Into.swift // Into.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,25 +30,23 @@ import CoreData
// MARK: - Into // MARK: - Into
/** /**
A `Into` clause contains the destination entity and destination persistent store for a `create(...)` method. A common usage is to just indicate the entity: An `Into` clause contains the destination entity and destination persistent store for a `create(...)` method. A common usage is to just indicate the entity:
```
let person = transaction.create(Into(MyPersonEntity)) let person = transaction.create(Into(MyPersonEntity))
```
For cases where multiple `NSPersistentStore`s contain the same entity, the destination configuration's name needs to be specified as well: For cases where multiple `NSPersistentStore`s contain the same entity, the destination configuration's name needs to be specified as well:
```
let person = transaction.create(Into<MyPersonEntity>("Configuration1")) let person = transaction.create(Into<MyPersonEntity>("Configuration1"))
```
This helps the `NSManagedObjectContext` to determine which */
*/
public struct Into<T: NSManagedObject> { public struct Into<T: NSManagedObject> {
// MARK: Public
/** /**
Initializes an `Into` clause. Initializes an `Into` clause.
Sample Usage: Sample Usage:
```
let person = transaction.create(Into<MyPersonEntity>()) let person = transaction.create(Into<MyPersonEntity>())
```
*/ */
public init(){ public init(){
@@ -60,9 +58,9 @@ public struct Into<T: NSManagedObject> {
/** /**
Initializes an `Into` clause with the specified entity type. Initializes an `Into` clause with the specified entity type.
Sample Usage: Sample Usage:
```
let person = transaction.create(Into(MyPersonEntity)) let person = transaction.create(Into(MyPersonEntity))
```
- parameter entity: the `NSManagedObject` type to be created - parameter entity: the `NSManagedObject` type to be created
*/ */
public init(_ entity: T.Type) { public init(_ entity: T.Type) {
@@ -74,7 +72,10 @@ public struct Into<T: NSManagedObject> {
/** /**
Initializes an `Into` clause with the specified entity class. Initializes an `Into` clause with the specified entity class.
Sample Usage:
```
let person = transaction.create(Into(MyPersonEntity))
```
- parameter entityClass: the `NSManagedObject` class type to be created - parameter entityClass: the `NSManagedObject` class type to be created
*/ */
public init(_ entityClass: AnyClass) { public init(_ entityClass: AnyClass) {
@@ -87,9 +88,9 @@ public struct Into<T: NSManagedObject> {
/** /**
Initializes an `Into` clause with the specified configuration. Initializes an `Into` clause with the specified configuration.
Sample Usage: Sample Usage:
```
let person = transaction.create(Into<MyPersonEntity>("Configuration1")) let person = transaction.create(Into<MyPersonEntity>("Configuration1"))
```
- parameter configuration: the `NSPersistentStore` configuration name to associate the object to. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. - parameter configuration: the `NSPersistentStore` configuration name to associate the object to. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration.
*/ */
public init(_ configuration: String?) { public init(_ configuration: String?) {
@@ -102,9 +103,9 @@ public struct Into<T: NSManagedObject> {
/** /**
Initializes an `Into` clause with the specified entity type and configuration. Initializes an `Into` clause with the specified entity type and configuration.
Sample Usage: Sample Usage:
```
let person = transaction.create(Into(MyPersonEntity.self, "Configuration1")) let person = transaction.create(Into(MyPersonEntity.self, "Configuration1"))
```
- parameter entity: the `NSManagedObject` type to be created - parameter entity: the `NSManagedObject` type to be created
- parameter configuration: the `NSPersistentStore` configuration name to associate the object to. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. - parameter configuration: the `NSPersistentStore` configuration name to associate the object to. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration.
*/ */
@@ -118,9 +119,9 @@ public struct Into<T: NSManagedObject> {
/** /**
Initializes an `Into` clause with the specified entity class and configuration. Initializes an `Into` clause with the specified entity class and configuration.
Sample Usage: Sample Usage:
```
let person = transaction.create(Into(MyPersonEntity.self, "Configuration1")) let person = transaction.create(Into(MyPersonEntity.self, "Configuration1"))
```
- parameter entityClass: the `NSManagedObject` class type to be created - parameter entityClass: the `NSManagedObject` class type to be created
- parameter configuration: the `NSPersistentStore` configuration name to associate the object to. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. - parameter configuration: the `NSPersistentStore` configuration name to associate the object to. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration.
*/ */
@@ -2,7 +2,7 @@
// NSManagedObject+Transaction.swift // NSManagedObject+Transaction.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2016 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +29,20 @@ import CoreData
// MARK: - NSManagedObject // MARK: - NSManagedObject
internal extension NSManagedObject { public extension NSManagedObject {
/**
Returns this object's parent `UnsafeDataTransaction` instance if it was created from one. Returns `nil` if the parent transaction is either an `AsynchronousDataTransaction` or a `SynchronousDataTransaction`, or if the object is not managed by CoreStore.
When using an `UnsafeDataTransaction` and passing around a temporary object, you can use this property to execute fetches and updates to the transaction without having to pass around both the object and the transaction instances.
Note that the internal reference to the transaction is `weak`, and it is still the developer's responsibility to retain a strong reference to the `UnsafeDataTransaction`.
*/
public var unsafeDataTransaction: UnsafeDataTransaction? {
return self.managedObjectContext?.parentTransaction as? UnsafeDataTransaction
}
// MARK: Internal // MARK: Internal
@@ -2,7 +2,7 @@
// SaveResult.swift // SaveResult.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -29,9 +29,9 @@ import Foundation
// MARK: - SaveResult // MARK: - SaveResult
/** /**
The `SaveResult` indicates the result of a `commit(...)` for a transaction. The `SaveResult` indicates the result of a `commit(...)` for a transaction.
The `SaveResult` can be treated as a boolean: The `SaveResult` can be treated as a boolean:
```
CoreStore.beginAsynchronous { transaction in CoreStore.beginAsynchronous { transaction in
// ... // ...
let result = transaction.commit() let result = transaction.commit()
@@ -42,9 +42,9 @@ The `SaveResult` can be treated as a boolean:
// failed // failed
} }
} }
```
or as an `enum`, where the resulting associated object can also be inspected: or as an `enum`, where the resulting associated object can also be inspected:
```
CoreStore.beginAsynchronous { transaction in CoreStore.beginAsynchronous { transaction in
// ... // ...
let result = transaction.commit() let result = transaction.commit()
@@ -55,12 +55,10 @@ or as an `enum`, where the resulting associated object can also be inspected:
// error is the NSError instance for the failure // error is the NSError instance for the failure
} }
} }
``` ```
*/ */
public enum SaveResult { public enum SaveResult {
// MARK: Public
/** /**
`SaveResult.Success` indicates that the `commit()` for the transaction succeeded, either because the save succeeded or because there were no changes to save. The associated value `hasChanges` indicates if there were saved changes or not. `SaveResult.Success` indicates that the `commit()` for the transaction succeeded, either because the save succeeded or because there were no changes to save. The associated value `hasChanges` indicates if there were saved changes or not.
*/ */
@@ -103,6 +101,7 @@ extension SaveResult: BooleanType {
public var boolValue: Bool { public var boolValue: Bool {
switch self { switch self {
case .Success: return true case .Success: return true
case .Failure: return false case .Failure: return false
} }
@@ -2,7 +2,7 @@
// SynchronousDataTransaction.swift // SynchronousDataTransaction.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -33,12 +33,10 @@ import CoreData
// MARK: - SynchronousDataTransaction // MARK: - SynchronousDataTransaction
/** /**
The `SynchronousDataTransaction` provides an interface for `NSManagedObject` creates, updates, and deletes. A transaction object should typically be only used from within a transaction block initiated from `DataStack.beginSynchronous(_:)`, or from `CoreStore.beginSynchronous(_:)`. The `SynchronousDataTransaction` provides an interface for `NSManagedObject` creates, updates, and deletes. A transaction object should typically be only used from within a transaction block initiated from `DataStack.beginSynchronous(_:)`, or from `CoreStore.beginSynchronous(_:)`.
*/ */
public final class SynchronousDataTransaction: BaseDataTransaction { public final class SynchronousDataTransaction: BaseDataTransaction {
// MARK: Public
/** /**
Saves the transaction changes and waits for completion synchronously. This method should not be used after the `commit()` method was already called once. Saves the transaction changes and waits for completion synchronously. This method should not be used after the `commit()` method was already called once.
*/ */
@@ -2,7 +2,7 @@
// UnsafeDataTransaction.swift // UnsafeDataTransaction.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -37,12 +37,10 @@ public typealias DetachedDataTransaction = UnsafeDataTransaction
// MARK: - UnsafeDataTransaction // MARK: - UnsafeDataTransaction
/** /**
The `UnsafeDataTransaction` provides an interface for non-contiguous `NSManagedObject` creates, updates, and deletes. This is useful for making temporary changes, such as partially filled forms. An unsafe transaction object should typically be only used from the main queue. The `UnsafeDataTransaction` provides an interface for non-contiguous `NSManagedObject` creates, updates, and deletes. This is useful for making temporary changes, such as partially filled forms. An unsafe transaction object should typically be only used from the main queue.
*/ */
public final class UnsafeDataTransaction: BaseDataTransaction { public final class UnsafeDataTransaction: BaseDataTransaction {
// MARK: Public
/** /**
Saves the transaction changes asynchronously. For a `UnsafeDataTransaction`, multiple commits are allowed, although it is the developer's responsibility to ensure a reasonable leeway to prevent blocking the main thread. Saves the transaction changes asynchronously. For a `UnsafeDataTransaction`, multiple commits are allowed, although it is the developer's responsibility to ensure a reasonable leeway to prevent blocking the main thread.
+3 -3
View File
@@ -2,7 +2,7 @@
// CoreStore+Setup.swift // CoreStore+Setup.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2015 John Rommel Estropia // Copyright © 2015 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -72,7 +72,7 @@ public extension CoreStore {
/** /**
Adds to the `defaultStack` an SQLite store from the given SQLite file name. Adds to the `defaultStack` an SQLite store from the given SQLite file name.
- parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory. A new SQLite file will be created if it does not exist. - parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory (or the "Caches" directory on tvOS). A new SQLite file will be created if it does not exist.
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to nil. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to nil.
- parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to throw exceptions on failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false - parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to throw exceptions on failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false
- returns: the `NSPersistentStore` added to the stack. - returns: the `NSPersistentStore` added to the stack.
@@ -89,7 +89,7 @@ public extension CoreStore {
/** /**
Adds to the `defaultStack` an SQLite store from the given SQLite file URL. Adds to the `defaultStack` an SQLite store from the given SQLite file URL.
- parameter fileURL: the local file URL for the SQLite persistent store. A new SQLite file will be created if it does not exist. If not specified, defaults to a file URL pointing to a "<Application name>.sqlite" file in the "Application Support" directory. - parameter fileURL: the local file URL for the SQLite persistent store. A new SQLite file will be created if it does not exist. If not specified, defaults to a file URL pointing to a "<Application name>.sqlite" file in the "Application Support" directory (or the "Caches" directory on tvOS).
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to nil. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to nil.
- parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to throw exceptions on failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false. - parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to throw exceptions on failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false.
- returns: the `NSPersistentStore` added to the stack. - returns: the `NSPersistentStore` added to the stack.
+24 -14
View File
@@ -2,7 +2,7 @@
// DataStack.swift // DataStack.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,28 +30,32 @@ import CoreData
#endif #endif
internal let applicationSupportDirectory = NSFileManager.defaultManager().URLsForDirectory(.ApplicationSupportDirectory, inDomains: .UserDomainMask).first! #if os(tvOS)
internal let deviceDirectorySearchPath = NSSearchPathDirectory.CachesDirectory
#else
internal let deviceDirectorySearchPath = NSSearchPathDirectory.ApplicationSupportDirectory
#endif
internal let defaultDirectory = NSFileManager.defaultManager().URLsForDirectory(deviceDirectorySearchPath, inDomains: .UserDomainMask).first!
internal let applicationName = (NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleName") as? String) ?? "CoreData" internal let applicationName = (NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleName") as? String) ?? "CoreData"
internal let defaultSQLiteStoreURL = applicationSupportDirectory.URLByAppendingPathComponent(applicationName, isDirectory: false).URLByAppendingPathExtension("sqlite") internal let defaultSQLiteStoreURL = defaultDirectory.URLByAppendingPathComponent(applicationName, isDirectory: false).URLByAppendingPathExtension("sqlite")
// MARK: - DataStack // MARK: - DataStack
/** /**
The `DataStack` encapsulates the data model for the Core Data stack. Each `DataStack` can have multiple data stores, usually specified as a "Configuration" in the model editor. Behind the scenes, the DataStack manages its own `NSPersistentStoreCoordinator`, a root `NSManagedObjectContext` for disk saves, and a shared `NSManagedObjectContext` designed as a read-only model interface for `NSManagedObjects`. The `DataStack` encapsulates the data model for the Core Data stack. Each `DataStack` can have multiple data stores, usually specified as a "Configuration" in the model editor. Behind the scenes, the DataStack manages its own `NSPersistentStoreCoordinator`, a root `NSManagedObjectContext` for disk saves, and a shared `NSManagedObjectContext` designed as a read-only model interface for `NSManagedObjects`.
*/ */
public final class DataStack { public final class DataStack {
// MARK: Public
/** /**
Initializes a `DataStack` from an `NSManagedObjectModel`. Initializes a `DataStack` from an `NSManagedObjectModel`.
- parameter modelName: the name of the (.xcdatamodeld) model file. If not specified, the application name will be used. - parameter modelName: the name of the (.xcdatamodeld) model file. If not specified, the application name will be used.
- parameter bundle: an optional bundle to load models from. If not specified, the main bundle will be used. - parameter bundle: an optional bundle to load models from. If not specified, the main bundle will be used.
- parameter migrationChain: the `MigrationChain` that indicates the sequence of model versions to be used as the order for incremental migration. If not specified, will default to a non-migrating data stack. - parameter migrationChain: the `MigrationChain` that indicates the sequence of model versions to be used as the order for progressive migrations. If not specified, will default to a non-migrating data stack.
*/ */
public required init(modelName: String = applicationName, bundle: NSBundle = NSBundle.mainBundle(), migrationChain: MigrationChain = nil) { public required init(modelName: String = applicationName, bundle: NSBundle = NSBundle.mainBundle(), migrationChain: MigrationChain = nil) {
@@ -156,7 +160,7 @@ public final class DataStack {
/** /**
Adds to the stack an SQLite store from the given SQLite file name. Adds to the stack an SQLite store from the given SQLite file name.
- parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory. A new SQLite file will be created if it does not exist. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them. - parameter fileName: the local filename for the SQLite persistent store in the "Application Support" directory (or the "Caches" directory on tvOS). A new SQLite file will be created if it does not exist. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them.
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them.
- parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to throw exceptions on failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false - parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to throw exceptions on failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false
- returns: the `NSPersistentStore` added to the stack. - returns: the `NSPersistentStore` added to the stack.
@@ -164,7 +168,7 @@ public final class DataStack {
public func addSQLiteStoreAndWait(fileName fileName: String, configuration: String? = nil, resetStoreOnModelMismatch: Bool = false) throws -> NSPersistentStore { public func addSQLiteStoreAndWait(fileName fileName: String, configuration: String? = nil, resetStoreOnModelMismatch: Bool = false) throws -> NSPersistentStore {
return try self.addSQLiteStoreAndWait( return try self.addSQLiteStoreAndWait(
fileURL: applicationSupportDirectory.URLByAppendingPathComponent( fileURL: defaultDirectory.URLByAppendingPathComponent(
fileName, fileName,
isDirectory: false isDirectory: false
), ),
@@ -176,7 +180,7 @@ public final class DataStack {
/** /**
Adds to the stack an SQLite store from the given SQLite file URL. Adds to the stack an SQLite store from the given SQLite file URL.
- parameter fileURL: the local file URL for the SQLite persistent store. A new SQLite file will be created if it does not exist. If not specified, defaults to a file URL pointing to a "<Application name>.sqlite" file in the "Application Support" directory. Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them. - parameter fileURL: the local file URL for the SQLite persistent store. A new SQLite file will be created if it does not exist. If not specified, defaults to a file URL pointing to a "<Application name>.sqlite" file in the "Application Support" directory (or the "Caches" directory on tvOS). Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them.
- parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them. - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them.
- parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to throw exceptions on failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false. - parameter resetStoreOnModelMismatch: Set to true to delete the store on model mismatch; or set to false to throw exceptions on failure instead. Typically should only be set to true when debugging, or if the persistent store can be recreated easily. If not specified, defaults to false.
- returns: the `NSPersistentStore` added to the stack. - returns: the `NSPersistentStore` added to the stack.
@@ -361,11 +365,17 @@ public final class DataStack {
self.configurationStoreMapping[configurationName] = persistentStore self.configurationStoreMapping[configurationName] = persistentStore
for entityDescription in (self.coordinator.managedObjectModel.entitiesForConfiguration(configurationName) ?? []) { for entityDescription in (self.coordinator.managedObjectModel.entitiesForConfiguration(configurationName) ?? []) {
if self.entityConfigurationsMapping[entityDescription.managedObjectClassName] == nil { let managedObjectClassName = entityDescription.managedObjectClassName
CoreStore.assert(
NSClassFromString(managedObjectClassName) != nil,
"The class \(typeName(managedObjectClassName)) for the entity \(typeName(entityDescription.name)) does not exist. Check if the subclass type and module name are properly configured."
)
self.entityConfigurationsMapping[entityDescription.managedObjectClassName] = [] if self.entityConfigurationsMapping[managedObjectClassName] == nil {
self.entityConfigurationsMapping[managedObjectClassName] = []
} }
self.entityConfigurationsMapping[entityDescription.managedObjectClassName]?.insert(configurationName) self.entityConfigurationsMapping[managedObjectClassName]?.insert(configurationName)
} }
} }
} }
@@ -2,7 +2,7 @@
// PersistentStoreResult.swift // PersistentStoreResult.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -30,9 +30,9 @@ import CoreData
// MARK: - PersistentStoreResult // MARK: - PersistentStoreResult
/** /**
The `PersistentStoreResult` indicates the result of an asynchronous initialization of a persistent store. The `PersistentStoreResult` indicates the result of an asynchronous initialization of a persistent store.
The `PersistentStoreResult` can be treated as a boolean: The `PersistentStoreResult` can be treated as a boolean:
```
try! CoreStore.addSQLiteStore(completion: { (result: PersistentStoreResult) -> Void in try! CoreStore.addSQLiteStore(completion: { (result: PersistentStoreResult) -> Void in
if result { if result {
// succeeded // succeeded
@@ -41,9 +41,9 @@ The `PersistentStoreResult` can be treated as a boolean:
// failed // failed
} }
}) })
```
or as an `enum`, where the resulting associated object can also be inspected: or as an `enum`, where the resulting associated object can also be inspected:
```
try! CoreStore.addSQLiteStore(completion: { (result: PersistentStoreResult) -> Void in try! CoreStore.addSQLiteStore(completion: { (result: PersistentStoreResult) -> Void in
switch result { switch result {
case .Success(let persistentStore): case .Success(let persistentStore):
@@ -52,12 +52,10 @@ or as an `enum`, where the resulting associated object can also be inspected:
// error is the NSError instance for the failure // error is the NSError instance for the failure
} }
}) })
``` ```
*/ */
public enum PersistentStoreResult { public enum PersistentStoreResult {
// MARK: Public
/** /**
`PersistentStoreResult.Success` indicates that the persistent store process succeeded. The associated object for this `enum` value is the related `NSPersistentStore` instance. `PersistentStoreResult.Success` indicates that the persistent store process succeeded. The associated object for this `enum` value is the related `NSPersistentStore` instance.
*/ */
@@ -88,9 +86,7 @@ public enum PersistentStoreResult {
internal init(_ errorCode: CoreStoreErrorCode, userInfo: [NSObject: AnyObject]?) { internal init(_ errorCode: CoreStoreErrorCode, userInfo: [NSObject: AnyObject]?) {
self.init(NSError( self.init(NSError(coreStoreErrorCode: errorCode, userInfo: userInfo))
coreStoreErrorCode: errorCode,
userInfo: userInfo))
} }
} }
@@ -99,8 +95,6 @@ public enum PersistentStoreResult {
extension PersistentStoreResult: BooleanType { extension PersistentStoreResult: BooleanType {
// MARK: Public
public var boolValue: Bool { public var boolValue: Bool {
switch self { switch self {
@@ -35,11 +35,11 @@
B569651A1B30888A0075EE4A /* FetchingResultsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56965191B30888A0075EE4A /* FetchingResultsViewController.swift */; }; B569651A1B30888A0075EE4A /* FetchingResultsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56965191B30888A0075EE4A /* FetchingResultsViewController.swift */; };
B569651C1B30889A0075EE4A /* QueryingResultsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B569651B1B30889A0075EE4A /* QueryingResultsViewController.swift */; }; B569651C1B30889A0075EE4A /* QueryingResultsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B569651B1B30889A0075EE4A /* QueryingResultsViewController.swift */; };
B56965291B3582D30075EE4A /* MigrationDemo.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = B56965271B3582D30075EE4A /* MigrationDemo.xcdatamodeld */; }; B56965291B3582D30075EE4A /* MigrationDemo.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = B56965271B3582D30075EE4A /* MigrationDemo.xcdatamodeld */; };
B583A9201AF5F542001F76AF /* CoreStore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B583A91B1AF5F4F4001F76AF /* CoreStore.framework */; };
B583A9211AF5F542001F76AF /* CoreStore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B583A91B1AF5F4F4001F76AF /* CoreStore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B5D9C9191B20AB1900E64F0E /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5D9C9181B20AB1900E64F0E /* GCDKit.framework */; };
B5D9C91A1B20AB1900E64F0E /* GCDKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B5D9C9181B20AB1900E64F0E /* GCDKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B5E599321B5240F50084BD5F /* OrganismTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E599311B5240F50084BD5F /* OrganismTableViewCell.swift */; }; B5E599321B5240F50084BD5F /* OrganismTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E599311B5240F50084BD5F /* OrganismTableViewCell.swift */; };
B5E89ACD1C52929C003B04A9 /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5BDC9241C202429008147CD /* GCDKit.framework */; };
B5E89ACE1C52929C003B04A9 /* GCDKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B5BDC9241C202429008147CD /* GCDKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B5E89AD01C5292A2003B04A9 /* CoreStore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5BDC9211C202429008147CD /* CoreStore.framework */; };
B5E89AD11C5292A2003B04A9 /* CoreStore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B5BDC9211C202429008147CD /* CoreStore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B5EE25851B36E23C0000406B /* OrganismV1.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EE25841B36E23C0000406B /* OrganismV1.swift */; }; B5EE25851B36E23C0000406B /* OrganismV1.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EE25841B36E23C0000406B /* OrganismV1.swift */; };
B5EE25871B36E2520000406B /* OrganismV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EE25861B36E2520000406B /* OrganismV2.swift */; }; B5EE25871B36E2520000406B /* OrganismV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EE25861B36E2520000406B /* OrganismV2.swift */; };
B5EE258C1B36E40D0000406B /* MigrationsDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EE258B1B36E40D0000406B /* MigrationsDemoViewController.swift */; }; B5EE258C1B36E40D0000406B /* MigrationsDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EE258B1B36E40D0000406B /* MigrationsDemoViewController.swift */; };
@@ -47,67 +47,15 @@
B5EE259E1B3EC1B20000406B /* OrganismProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EE259D1B3EC1B20000406B /* OrganismProtocol.swift */; }; B5EE259E1B3EC1B20000406B /* OrganismProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EE259D1B3EC1B20000406B /* OrganismProtocol.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
B5202CF11C044CC800DED140 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B583A9141AF5F4F3001F76AF /* CoreStore.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = B52DD1741BE1F8CC00949AFE;
remoteInfo = "CoreStore OSX";
};
B5202CF31C044CC800DED140 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B583A9141AF5F4F3001F76AF /* CoreStore.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = B52DD17D1BE1F8CC00949AFE;
remoteInfo = "CoreStoreTests OSX";
};
B56321C51BD65965006C9394 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B583A9141AF5F4F3001F76AF /* CoreStore.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = B563216F1BD65082006C9394;
remoteInfo = "CoreStore watchOS";
};
B583A91A1AF5F4F4001F76AF /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B583A9141AF5F4F3001F76AF /* CoreStore.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 2F03A53019C5C6DA005002A5;
remoteInfo = CoreStore;
};
B583A91C1AF5F4F4001F76AF /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B583A9141AF5F4F3001F76AF /* CoreStore.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 2F03A53B19C5C6DA005002A5;
remoteInfo = CoreStoreTests;
};
B583A91E1AF5F512001F76AF /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B583A9141AF5F4F3001F76AF /* CoreStore.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 2F03A52F19C5C6DA005002A5;
remoteInfo = CoreStore;
};
B583A9221AF5F542001F76AF /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B583A9141AF5F4F3001F76AF /* CoreStore.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 2F03A52F19C5C6DA005002A5;
remoteInfo = CoreStore;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
B583A9241AF5F542001F76AF /* Embed Frameworks */ = { B5E89ACF1C52929C003B04A9 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase; isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
B5D9C91A1B20AB1900E64F0E /* GCDKit.framework in Embed Frameworks */, B5E89ACE1C52929C003B04A9 /* GCDKit.framework in Embed Frameworks */,
B583A9211AF5F542001F76AF /* CoreStore.framework in Embed Frameworks */, B5E89AD11C5292A2003B04A9 /* CoreStore.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -145,8 +93,8 @@
B56965191B30888A0075EE4A /* FetchingResultsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchingResultsViewController.swift; sourceTree = "<group>"; }; B56965191B30888A0075EE4A /* FetchingResultsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchingResultsViewController.swift; sourceTree = "<group>"; };
B569651B1B30889A0075EE4A /* QueryingResultsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryingResultsViewController.swift; sourceTree = "<group>"; }; B569651B1B30889A0075EE4A /* QueryingResultsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryingResultsViewController.swift; sourceTree = "<group>"; };
B56965281B3582D30075EE4A /* MigrationDemo.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MigrationDemo.xcdatamodel; sourceTree = "<group>"; }; B56965281B3582D30075EE4A /* MigrationDemo.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MigrationDemo.xcdatamodel; sourceTree = "<group>"; };
B583A9141AF5F4F3001F76AF /* CoreStore.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CoreStore.xcodeproj; path = ../CoreStore.xcodeproj; sourceTree = "<group>"; }; B5BDC9211C202429008147CD /* CoreStore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CoreStore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B5D9C9181B20AB1900E64F0E /* GCDKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = GCDKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; B5BDC9241C202429008147CD /* GCDKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = GCDKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B5E599311B5240F50084BD5F /* OrganismTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OrganismTableViewCell.swift; path = "CoreStoreDemo/MIgrations Demo/OrganismTableViewCell.swift"; sourceTree = SOURCE_ROOT; }; B5E599311B5240F50084BD5F /* OrganismTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OrganismTableViewCell.swift; path = "CoreStoreDemo/MIgrations Demo/OrganismTableViewCell.swift"; sourceTree = SOURCE_ROOT; };
B5EE25801B36E1B00000406B /* MigrationDemoV2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MigrationDemoV2.xcdatamodel; sourceTree = "<group>"; }; B5EE25801B36E1B00000406B /* MigrationDemoV2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MigrationDemoV2.xcdatamodel; sourceTree = "<group>"; };
B5EE25841B36E23C0000406B /* OrganismV1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrganismV1.swift; sourceTree = "<group>"; }; B5EE25841B36E23C0000406B /* OrganismV1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrganismV1.swift; sourceTree = "<group>"; };
@@ -162,10 +110,10 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
B5E89ACD1C52929C003B04A9 /* GCDKit.framework in Frameworks */,
B5E89AD01C5292A2003B04A9 /* CoreStore.framework in Frameworks */,
B52977E11B120F8A003D50A5 /* CoreLocation.framework in Frameworks */, B52977E11B120F8A003D50A5 /* CoreLocation.framework in Frameworks */,
B52977DF1B120F83003D50A5 /* MapKit.framework in Frameworks */, B52977DF1B120F83003D50A5 /* MapKit.framework in Frameworks */,
B5D9C9191B20AB1900E64F0E /* GCDKit.framework in Frameworks */,
B583A9201AF5F542001F76AF /* CoreStore.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -196,9 +144,9 @@
B52977E21B120F90003D50A5 /* Frameworks */ = { B52977E21B120F90003D50A5 /* Frameworks */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
B583A9141AF5F4F3001F76AF /* CoreStore.xcodeproj */,
B5D9C9181B20AB1900E64F0E /* GCDKit.framework */,
B52977E01B120F8A003D50A5 /* CoreLocation.framework */, B52977E01B120F8A003D50A5 /* CoreLocation.framework */,
B5BDC9211C202429008147CD /* CoreStore.framework */,
B5BDC9241C202429008147CD /* GCDKit.framework */,
B52977DE1B120F83003D50A5 /* MapKit.framework */, B52977DE1B120F83003D50A5 /* MapKit.framework */,
); );
name = Frameworks; name = Frameworks;
@@ -296,18 +244,6 @@
path = "Migrations Demo"; path = "Migrations Demo";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
B583A9151AF5F4F3001F76AF /* Products */ = {
isa = PBXGroup;
children = (
B583A91B1AF5F4F4001F76AF /* CoreStore.framework */,
B583A91D1AF5F4F4001F76AF /* CoreStoreTests.xctest */,
B56321C61BD65965006C9394 /* CoreStore.framework */,
B5202CF21C044CC800DED140 /* CoreStore.framework */,
B5202CF41C044CC800DED140 /* CoreStoreTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
@@ -318,13 +254,11 @@
B54AAD451AF4D26E00848AE0 /* Sources */, B54AAD451AF4D26E00848AE0 /* Sources */,
B54AAD461AF4D26E00848AE0 /* Frameworks */, B54AAD461AF4D26E00848AE0 /* Frameworks */,
B54AAD471AF4D26E00848AE0 /* Resources */, B54AAD471AF4D26E00848AE0 /* Resources */,
B583A9241AF5F542001F76AF /* Embed Frameworks */, B5E89ACF1C52929C003B04A9 /* Embed Frameworks */,
); );
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
B583A91F1AF5F512001F76AF /* PBXTargetDependency */,
B583A9231AF5F542001F76AF /* PBXTargetDependency */,
); );
name = CoreStoreDemo; name = CoreStoreDemo;
productName = CoreStoreDemo; productName = CoreStoreDemo;
@@ -357,12 +291,6 @@
mainGroup = B54AAD401AF4D26E00848AE0; mainGroup = B54AAD401AF4D26E00848AE0;
productRefGroup = B54AAD4A1AF4D26E00848AE0 /* Products */; productRefGroup = B54AAD4A1AF4D26E00848AE0 /* Products */;
projectDirPath = ""; projectDirPath = "";
projectReferences = (
{
ProductGroup = B583A9151AF5F4F3001F76AF /* Products */;
ProjectRef = B583A9141AF5F4F3001F76AF /* CoreStore.xcodeproj */;
},
);
projectRoot = ""; projectRoot = "";
targets = ( targets = (
B54AAD481AF4D26E00848AE0 /* CoreStoreDemo */, B54AAD481AF4D26E00848AE0 /* CoreStoreDemo */,
@@ -370,44 +298,6 @@
}; };
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXReferenceProxy section */
B5202CF21C044CC800DED140 /* CoreStore.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = CoreStore.framework;
remoteRef = B5202CF11C044CC800DED140 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B5202CF41C044CC800DED140 /* CoreStoreTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = CoreStoreTests.xctest;
remoteRef = B5202CF31C044CC800DED140 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B56321C61BD65965006C9394 /* CoreStore.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = CoreStore.framework;
remoteRef = B56321C51BD65965006C9394 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B583A91B1AF5F4F4001F76AF /* CoreStore.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = CoreStore.framework;
remoteRef = B583A91A1AF5F4F4001F76AF /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B583A91D1AF5F4F4001F76AF /* CoreStoreTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = CoreStoreTests.xctest;
remoteRef = B583A91C1AF5F4F4001F76AF /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */ /* Begin PBXResourcesBuildPhase section */
B54AAD471AF4D26E00848AE0 /* Resources */ = { B54AAD471AF4D26E00848AE0 /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
@@ -460,19 +350,6 @@
}; };
/* End PBXSourcesBuildPhase section */ /* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
B583A91F1AF5F512001F76AF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = CoreStore;
targetProxy = B583A91E1AF5F512001F76AF /* PBXContainerItemProxy */;
};
B583A9231AF5F542001F76AF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = CoreStore;
targetProxy = B583A9221AF5F542001F76AF /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */ /* Begin PBXVariantGroup section */
B54AAD571AF4D26E00848AE0 /* Main.storyboard */ = { B54AAD571AF4D26E00848AE0 /* Main.storyboard */ = {
isa = PBXVariantGroup; isa = PBXVariantGroup;
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/05/02. // Created by John Rommel Estropia on 2015/05/02.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import UIKit import UIKit
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/12. // Created by John Rommel Estropia on 2015/06/12.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import UIKit import UIKit
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/17. // Created by John Rommel Estropia on 2015/06/17.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import UIKit import UIKit
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/17. // Created by John Rommel Estropia on 2015/06/17.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import UIKit import UIKit
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/15. // Created by John Rommel Estropia on 2015/06/15.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import Foundation import Foundation
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/05/02. // Created by John Rommel Estropia on 2015/05/02.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import UIKit import UIKit
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/05/06. // Created by John Rommel Estropia on 2015/05/06.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import UIKit import UIKit
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/05/24. // Created by John Rommel Estropia on 2015/05/24.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import UIKit import UIKit
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/05/05. // Created by John Rommel Estropia on 2015/05/05.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import Foundation import Foundation
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/05/05. // Created by John Rommel Estropia on 2015/05/05.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import UIKit import UIKit
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/05. // Created by John Rommel Estropia on 2015/06/05.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import UIKit import UIKit
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/21. // Created by John Rommel Estropia on 2015/06/21.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import UIKit import UIKit
@@ -39,7 +39,7 @@ class MigrationsDemoViewController: UIViewController {
let alert = UIAlertController( let alert = UIAlertController(
title: "Migrations Demo", title: "Migrations Demo",
message: "This demo shows how to run incremental migrations and how to support multiple model versions in a single project.\n\nThe persistent store contains 10000 organisms, which gain/lose properties when the migration evolves/devolves them.\n\nYou can use the \"mutate\" button to change an organism's properties then migrate to a different model to see how its value gets affected.", message: "This demo shows how to run progressive migrations and how to support multiple model versions in a single project.\n\nThe persistent store contains 10000 organisms, which gain/lose properties when the migration evolves/devolves them.\n\nYou can use the \"mutate\" button to change an organism's properties then migrate to a different model to see how its value gets affected.",
preferredStyle: .Alert preferredStyle: .Alert
) )
alert.addAction(UIAlertAction(title: "OK", style: .Cancel, handler: nil)) alert.addAction(UIAlertAction(title: "OK", style: .Cancel, handler: nil))
@@ -267,7 +267,7 @@ class MigrationsDemoViewController: UIViewController {
self.progressView?.setProgress(Float(progress.fractionCompleted), animated: true) self.progressView?.setProgress(Float(progress.fractionCompleted), animated: true)
self.titleLabel?.text = "Migrating: \(progress.localizedDescription)" self.titleLabel?.text = "Migrating: \(progress.localizedDescription)"
self.organismLabel?.text = "Incremental step \(progress.localizedAdditionalDescription)" self.organismLabel?.text = "Progressive step \(progress.localizedAdditionalDescription)"
} }
private func updateDisplay(reloadData reloadData: Bool, scrollToSelection: Bool, animated: Bool) { private func updateDisplay(reloadData reloadData: Bool, scrollToSelection: Bool, animated: Bool) {
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/27. // Created by John Rommel Estropia on 2015/06/27.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import Foundation import Foundation
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/21. // Created by John Rommel Estropia on 2015/06/21.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import Foundation import Foundation
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/21. // Created by John Rommel Estropia on 2015/06/21.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import Foundation import Foundation
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/27. // Created by John Rommel Estropia on 2015/06/27.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import CoreData import CoreData
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/27. // Created by John Rommel Estropia on 2015/06/27.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import Foundation import Foundation
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/06. // Created by John Rommel Estropia on 2015/06/06.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import Foundation import Foundation
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/06/06. // Created by John Rommel Estropia on 2015/06/06.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import Foundation import Foundation
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/05/24. // Created by John Rommel Estropia on 2015/05/24.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import UIKit import UIKit
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/05/24. // Created by John Rommel Estropia on 2015/05/24.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import Foundation import Foundation
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/05/24. // Created by John Rommel Estropia on 2015/05/24.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import Foundation import Foundation
@@ -3,7 +3,7 @@
// CoreStoreDemo // CoreStoreDemo
// //
// Created by John Rommel Estropia on 2015/05/24. // Created by John Rommel Estropia on 2015/05/24.
// Copyright (c) 2015 John Rommel Estropia. All rights reserved. // Copyright © 2015 John Rommel Estropia. All rights reserved.
// //
import UIKit import UIKit
+5 -2
View File
@@ -2,7 +2,7 @@
// CoreStoreTests.swift // CoreStoreTests.swift
// CoreStoreTests // CoreStoreTests
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -295,6 +295,7 @@ class CoreStoreTests: XCTestCase {
obj5.testString = "hihihi" obj5.testString = "hihihi"
obj5.testNumber = 70 obj5.testNumber = 70
obj5.testDate = NSDate() obj5.testDate = NSDate()
XCTAssert(unsafeTransaction === obj5.unsafeDataTransaction, "unsafeTransaction === obj5.unsafeDataTransaction")
unsafeTransaction.commit { (result) -> Void in unsafeTransaction.commit { (result) -> Void in
@@ -309,6 +310,7 @@ class CoreStoreTests: XCTestCase {
let obj5Copy1 = transaction.edit(obj5) let obj5Copy1 = transaction.edit(obj5)
XCTAssertTrue(obj5.objectID == obj5Copy1?.objectID, "obj5.objectID == obj5Copy1?.objectID") XCTAssertTrue(obj5.objectID == obj5Copy1?.objectID, "obj5.objectID == obj5Copy1?.objectID")
XCTAssertFalse(obj5 == obj5Copy1, "obj5 == obj5Copy1") XCTAssertFalse(obj5 == obj5Copy1, "obj5 == obj5Copy1")
XCTAssertNil(obj5Copy1?.unsafeDataTransaction)
let obj5Copy2 = transaction.edit(Into(TestEntity1), obj5.objectID) let obj5Copy2 = transaction.edit(Into(TestEntity1), obj5.objectID)
XCTAssertTrue(obj5.objectID == obj5Copy2?.objectID, "obj5.objectID == obj5Copy2?.objectID") XCTAssertTrue(obj5.objectID == obj5Copy2?.objectID, "obj5.objectID == obj5Copy2?.objectID")
@@ -326,6 +328,7 @@ class CoreStoreTests: XCTestCase {
obj6.testString = "huehuehue" obj6.testString = "huehuehue"
obj6.testNumber = 130 obj6.testNumber = 130
obj6.testDate = NSDate() obj6.testDate = NSDate()
XCTAssert(unsafeTransaction === obj6.unsafeDataTransaction, "unsafeTransaction === obj6.unsafeDataTransaction")
unsafeTransaction.commit { (result) -> Void in unsafeTransaction.commit { (result) -> Void in
@@ -378,7 +381,7 @@ class CoreStoreTests: XCTestCase {
let fileManager = NSFileManager.defaultManager() let fileManager = NSFileManager.defaultManager()
try fileManager.removeItemAtURL( try fileManager.removeItemAtURL(
fileManager.URLsForDirectory(.ApplicationSupportDirectory, inDomains: .UserDomainMask).first! fileManager.URLsForDirectory(deviceDirectorySearchPath, inDomains: .UserDomainMask).first!
) )
} }
catch _ { } catch _ { }
+1 -1
View File
@@ -2,7 +2,7 @@
// TestEntity1.swift // TestEntity1.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -2,7 +2,7 @@
// TestEntity1.swift // TestEntity1.swift
// CoreStore // CoreStore
// //
// Copyright (c) 2014 John Rommel Estropia // Copyright © 2014 John Rommel Estropia
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 John Rommel Estropia Copyright © 2014 John Rommel Estropia
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

Some files were not shown because too many files have changed in this diff Show More