fixed platform dependencies

This commit is contained in:
John Rommel Estropia
2016-06-17 01:24:19 +09:00
parent 76a2bc1da2
commit 2dc09289bf
33 changed files with 662 additions and 48 deletions

View File

@@ -13,7 +13,6 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = "9.0"
s.source_files = "Sources", "Sources/**/*.{swift}"
s.osx.exclude_files = "Sources/Observing/*.{swift}", "Sources/Internal/FetchedResultsControllerDelegate.swift", "Sources/Internal/CoreStoreFetchedResultsController.swift", "Sources/Convenience Helpers/NSFetchedResultsController+Convenience.swift"
s.frameworks = "Foundation", "CoreData"
s.requires_arc = true
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-D USE_FRAMEWORKS' }

View File

@@ -99,10 +99,33 @@
B5202CFD1C046E8400DED140 /* NSFetchedResultsController+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */; };
B5220E081D0C5F8D009BC71E /* ObjectObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5220E071D0C5F8D009BC71E /* ObjectObserverTests.swift */; };
B5220E091D0C5F8D009BC71E /* ObjectObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5220E071D0C5F8D009BC71E /* ObjectObserverTests.swift */; };
B5220E0A1D0C5F8D009BC71E /* ObjectObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5220E071D0C5F8D009BC71E /* ObjectObserverTests.swift */; };
B5220E0C1D0D0D19009BC71E /* ImportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5220E0B1D0D0D19009BC71E /* ImportTests.swift */; };
B5220E0D1D0D0D19009BC71E /* ImportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5220E0B1D0D0D19009BC71E /* ImportTests.swift */; };
B5220E0E1D0D0D19009BC71E /* ImportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5220E0B1D0D0D19009BC71E /* ImportTests.swift */; };
B5220E101D0DA6AB009BC71E /* ListObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5220E0F1D0DA6AB009BC71E /* ListObserverTests.swift */; };
B5220E111D0DA6AB009BC71E /* ListObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5220E0F1D0DA6AB009BC71E /* ListObserverTests.swift */; };
B5220E131D1305ED009BC71E /* SectionBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56007131B3F6C2800A9A8F9 /* SectionBy.swift */; };
B5220E141D130614009BC71E /* DataStack+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1A1AFF84860064E85B /* DataStack+Observing.swift */; };
B5220E151D130663009BC71E /* CoreStore+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1B1AFF84860064E85B /* CoreStore+Observing.swift */; };
B5220E161D13067C009BC71E /* ObjectMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1C1AFF84860064E85B /* ObjectMonitor.swift */; };
B5220E171D1306DF009BC71E /* UnsafeDataTransaction+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C976E21C6C9F6A00B1AF90 /* UnsafeDataTransaction+Observing.swift */; };
B5220E181D130711009BC71E /* ObjectObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1F1AFF84860064E85B /* ObjectObserver.swift */; };
B5220E191D130761009BC71E /* ListMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1D1AFF84860064E85B /* ListMonitor.swift */; };
B5220E1A1D130791009BC71E /* CoreStoreFetchedResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C976E61C6E3A5900B1AF90 /* CoreStoreFetchedResultsController.swift */; };
B5220E1B1D13079B009BC71E /* CSCoreStore+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5A11CAA4365007FD580 /* CSCoreStore+Observing.swift */; };
B5220E1C1D130801009BC71E /* FetchedResultsControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54A6A541BA15F2A007870FD /* FetchedResultsControllerDelegate.swift */; };
B5220E1D1D13080A009BC71E /* CSDataStack+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B59C1CAA2568007FD580 /* CSDataStack+Observing.swift */; };
B5220E1E1D13080D009BC71E /* CSListMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDE11CA8D1F500BE22EF /* CSListMonitor.swift */; };
B5220E1F1D130810009BC71E /* CSListObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDE61CA8D20500BE22EF /* CSListObserver.swift */; };
B5220E201D130813009BC71E /* CSObjectMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5921CAA0C15007FD580 /* CSObjectMonitor.swift */; };
B5220E211D130816009BC71E /* CSObjectObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5971CAA0C23007FD580 /* CSObjectObserver.swift */; };
B5220E221D130818009BC71E /* CSSectionBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDDC1CA8D05000BE22EF /* CSSectionBy.swift */; };
B5220E231D130826009BC71E /* NSFetchedResultsController+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA1D1CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift */; };
B5220E241D13085E009BC71E /* NSFetchedResultsController+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */; };
B5220E251D13088E009BC71E /* ListObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1E1AFF84860064E85B /* ListObserver.swift */; };
B5220E261D1308C2009BC71E /* ListObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5220E0F1D0DA6AB009BC71E /* ListObserverTests.swift */; };
B5220E271D1308D1009BC71E /* ObjectObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5220E071D0C5F8D009BC71E /* ObjectObserverTests.swift */; };
B5220E281D1308E5009BC71E /* SectionByTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52557831D02A07400E51965 /* SectionByTests.swift */; };
B525576C1CFAF18F00E51965 /* IntoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B525576B1CFAF18F00E51965 /* IntoTests.swift */; };
B525576D1CFAF18F00E51965 /* IntoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B525576B1CFAF18F00E51965 /* IntoTests.swift */; };
B525576E1CFAF18F00E51965 /* IntoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B525576B1CFAF18F00E51965 /* IntoTests.swift */; };
@@ -123,7 +146,6 @@
B52557821D029D2500E51965 /* TweakTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B525577F1D029D2500E51965 /* TweakTests.swift */; };
B52557841D02A07400E51965 /* SectionByTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52557831D02A07400E51965 /* SectionByTests.swift */; };
B52557851D02A07400E51965 /* SectionByTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52557831D02A07400E51965 /* SectionByTests.swift */; };
B52557861D02A07400E51965 /* SectionByTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52557831D02A07400E51965 /* SectionByTests.swift */; };
B52557881D02DE8100E51965 /* FetchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52557871D02DE8100E51965 /* FetchTests.swift */; };
B52557891D02DE8100E51965 /* FetchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52557871D02DE8100E51965 /* FetchTests.swift */; };
B525578A1D02DE8100E51965 /* FetchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52557871D02DE8100E51965 /* FetchTests.swift */; };
@@ -680,6 +702,7 @@
B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSFetchedResultsController+Convenience.swift"; sourceTree = "<group>"; };
B5220E071D0C5F8D009BC71E /* ObjectObserverTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectObserverTests.swift; sourceTree = "<group>"; };
B5220E0B1D0D0D19009BC71E /* ImportTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImportTests.swift; sourceTree = "<group>"; };
B5220E0F1D0DA6AB009BC71E /* ListObserverTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListObserverTests.swift; sourceTree = "<group>"; };
B525576B1CFAF18F00E51965 /* IntoTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntoTests.swift; sourceTree = "<group>"; };
B525576F1D02561A00E51965 /* SelectTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectTests.swift; sourceTree = "<group>"; };
B52557731D02791400E51965 /* WhereTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WhereTests.swift; sourceTree = "<group>"; };
@@ -964,6 +987,7 @@
B525577B1D0291FE00E51965 /* GroupByTests.swift */,
B5220E0B1D0D0D19009BC71E /* ImportTests.swift */,
B525576B1CFAF18F00E51965 /* IntoTests.swift */,
B5220E0F1D0DA6AB009BC71E /* ListObserverTests.swift */,
B5DC47C51C93D22900FA3BF3 /* MigrationChainTests.swift */,
B5220E071D0C5F8D009BC71E /* ObjectObserverTests.swift */,
B52557771D02826E00E51965 /* OrderByTests.swift */,
@@ -1766,6 +1790,7 @@
buildActionMask = 2147483647;
files = (
B52557841D02A07400E51965 /* SectionByTests.swift in Sources */,
B5220E101D0DA6AB009BC71E /* ListObserverTests.swift in Sources */,
B5519A401CA1B17B002BEF78 /* ErrorTests.swift in Sources */,
B525577C1D0291FE00E51965 /* GroupByTests.swift in Sources */,
B52557741D02791400E51965 /* WhereTests.swift in Sources */,
@@ -1912,6 +1937,7 @@
buildActionMask = 2147483647;
files = (
B52557851D02A07400E51965 /* SectionByTests.swift in Sources */,
B5220E111D0DA6AB009BC71E /* ListObserverTests.swift in Sources */,
B5519A411CA1B17B002BEF78 /* ErrorTests.swift in Sources */,
B525577D1D0291FE00E51965 /* GroupByTests.swift in Sources */,
B52557751D02791400E51965 /* WhereTests.swift in Sources */,
@@ -1941,6 +1967,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B5220E1E1D13080D009BC71E /* CSListMonitor.swift in Sources */,
B5DBE2D01C9914A900B5CEFA /* CSCoreStore.swift in Sources */,
B5677D411CD3B1E400322BFC /* ICloudStoreObserver.swift in Sources */,
B52DD1BE1BE1F94300949AFE /* NSProgress+Convenience.swift in Sources */,
@@ -1956,17 +1983,22 @@
B5ECDC2D1CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */,
B5D7A5BA1CA3BF8F005C752B /* CSInto.swift in Sources */,
B5A5F26A1CAEC50F004AB9AF /* CSSelect.swift in Sources */,
B5220E1B1D13079B009BC71E /* CSCoreStore+Observing.swift in Sources */,
B5FEC1911C9166E700532541 /* NSPersistentStore+Setup.swift in Sources */,
B52DD1AB1BE1F93900949AFE /* From.swift in Sources */,
B546F95B1C99B17400D5AC55 /* CSCoreStore+Setup.swift in Sources */,
B52DD1A11BE1F92C00949AFE /* DataStack+Transaction.swift in Sources */,
B5D3F6481C887C0A00C7492A /* LegacySQLiteStore.swift in Sources */,
B5220E1C1D130801009BC71E /* FetchedResultsControllerDelegate.swift in Sources */,
B52DD19E1BE1F92C00949AFE /* AsynchronousDataTransaction.swift in Sources */,
B52DD1981BE1F92500949AFE /* CoreStore+Setup.swift in Sources */,
B5220E241D13085E009BC71E /* NSFetchedResultsController+Convenience.swift in Sources */,
B559CD471CAA8B6300E4D58B /* CSSetupResult.swift in Sources */,
B5ECDBF01CA6BF2000C7F112 /* CSFrom.swift in Sources */,
B5220E1F1D130810009BC71E /* CSListObserver.swift in Sources */,
B52DD1941BE1F92500949AFE /* CoreStore.swift in Sources */,
B52DD1A61BE1F92F00949AFE /* BaseDataTransaction+Importing.swift in Sources */,
B5220E1D1D13080A009BC71E /* CSDataStack+Observing.swift in Sources */,
B52DD1A91BE1F93200949AFE /* CoreStore+Querying.swift in Sources */,
B5519A4D1CA1F4FB002BEF78 /* CSError.swift in Sources */,
B5E1B5AC1CAA49E2007FD580 /* CSDataStack+Migrating.swift in Sources */,
@@ -1984,8 +2016,11 @@
B52DD1C31BE1F94600949AFE /* NotificationObserver.swift in Sources */,
B52661441CADD585007B85D9 /* CoreStoreFetchRequest.swift in Sources */,
B52DD1A81BE1F93200949AFE /* DataStack+Querying.swift in Sources */,
B5220E221D130818009BC71E /* CSSectionBy.swift in Sources */,
B52DD1BC1BE1F94000949AFE /* MigrationResult.swift in Sources */,
B5220E231D130826009BC71E /* NSFetchedResultsController+ObjectiveC.swift in Sources */,
B52DD19D1BE1F92C00949AFE /* BaseDataTransaction.swift in Sources */,
B5220E131D1305ED009BC71E /* SectionBy.swift in Sources */,
B559CD4D1CAA8C6D00E4D58B /* CSStorageInterface.swift in Sources */,
B5ECDBE91CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */,
B52DD1B81BE1F94000949AFE /* DataStack+Migration.swift in Sources */,
@@ -2001,27 +2036,37 @@
B52DD1B01BE1F93900949AFE /* Tweak.swift in Sources */,
B52DD1CA1BE1F94600949AFE /* NSManagedObjectModel+Setup.swift in Sources */,
B52DD1A41BE1F92F00949AFE /* ImportableObject.swift in Sources */,
B5220E161D13067C009BC71E /* ObjectMonitor.swift in Sources */,
B52DD1AE1BE1F93900949AFE /* OrderBy.swift in Sources */,
B52DD1BA1BE1F94000949AFE /* MigrationChain.swift in Sources */,
B50392FB1C479640009900CA /* NSManagedObject+Transaction.swift in Sources */,
B52DD1A31BE1F92C00949AFE /* SaveResult.swift in Sources */,
B5220E211D130816009BC71E /* CSObjectObserver.swift in Sources */,
B52DD19F1BE1F92C00949AFE /* SynchronousDataTransaction.swift in Sources */,
B52DD1CB1BE1F94600949AFE /* WeakObject.swift in Sources */,
B52DD1C11BE1F94600949AFE /* Functions.swift in Sources */,
B5220E1A1D130791009BC71E /* CoreStoreFetchedResultsController.swift in Sources */,
B53FBA0F1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift in Sources */,
B59FA0B21CCBACA8007C9BCA /* ICloudStore.swift in Sources */,
B52DD19A1BE1F92800949AFE /* CoreStore+Logging.swift in Sources */,
B52DD1A71BE1F93200949AFE /* BaseDataTransaction+Querying.swift in Sources */,
B546F96C1C9AF26D00D5AC55 /* CSInMemoryStore.swift in Sources */,
B52DD1C61BE1F94600949AFE /* NSManagedObjectContext+CoreStore.swift in Sources */,
B5220E141D130614009BC71E /* DataStack+Observing.swift in Sources */,
B52DD1A21BE1F92C00949AFE /* CoreStore+Transaction.swift in Sources */,
B5E2222E1CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift in Sources */,
B5220E191D130761009BC71E /* ListMonitor.swift in Sources */,
B5220E181D130711009BC71E /* ObjectObserver.swift in Sources */,
B5220E251D13088E009BC71E /* ListObserver.swift in Sources */,
B52DD1A01BE1F92C00949AFE /* UnsafeDataTransaction.swift in Sources */,
B5ECDC331CA81CDC00C7F112 /* CSCoreStore+Transaction.swift in Sources */,
B52DD1BB1BE1F94000949AFE /* MigrationType.swift in Sources */,
B52DD1C91BE1F94600949AFE /* NSManagedObjectContext+Transaction.swift in Sources */,
B5220E151D130663009BC71E /* CoreStore+Observing.swift in Sources */,
B52DD19B1BE1F92800949AFE /* CoreStoreLogger.swift in Sources */,
B52DD1991BE1F92800949AFE /* DefaultLogger.swift in Sources */,
B5220E201D130813009BC71E /* CSObjectMonitor.swift in Sources */,
B5220E171D1306DF009BC71E /* UnsafeDataTransaction+Observing.swift in Sources */,
B53FBA081CAB300C00F0D40A /* CSMigrationType.swift in Sources */,
B52DD1B91BE1F94000949AFE /* CoreStore+Migration.swift in Sources */,
B5519A5C1CA2008C002BEF78 /* CSBaseDataTransaction.swift in Sources */,
@@ -2038,8 +2083,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B52557861D02A07400E51965 /* SectionByTests.swift in Sources */,
B5519A421CA1B17B002BEF78 /* ErrorTests.swift in Sources */,
B5220E271D1308D1009BC71E /* ObjectObserverTests.swift in Sources */,
B525577E1D0291FE00E51965 /* GroupByTests.swift in Sources */,
B52557761D02791400E51965 /* WhereTests.swift in Sources */,
B5DC47C81C93D22900FA3BF3 /* MigrationChainTests.swift in Sources */,
@@ -2048,8 +2093,8 @@
B525576E1CFAF18F00E51965 /* IntoTests.swift in Sources */,
B580857C1CDF808F004C2EEB /* SetupTests.swift in Sources */,
B525578A1D02DE8100E51965 /* FetchTests.swift in Sources */,
B5220E281D1308E5009BC71E /* SectionByTests.swift in Sources */,
B5489F521CF603D5008B4978 /* FromTests.swift in Sources */,
B5220E0A1D0C5F8D009BC71E /* ObjectObserverTests.swift in Sources */,
B525577A1D02826E00E51965 /* OrderByTests.swift in Sources */,
B5489F441CF5EEBC008B4978 /* TestEntity2.swift in Sources */,
B52557721D02561A00E51965 /* SelectTests.swift in Sources */,
@@ -2057,6 +2102,7 @@
B52557821D029D2500E51965 /* TweakTests.swift in Sources */,
B5489F4E1CF5F743008B4978 /* BaseTestCase.swift in Sources */,
B5598BCC1BE2093D0092EFCE /* Model.xcdatamodeld in Sources */,
B5220E261D1308C2009BC71E /* ListObserverTests.swift in Sources */,
B57D27C01D0BBE8200539C58 /* BaseTestDataTestCase.swift in Sources */,
B5489F411CF5EEBC008B4978 /* TestEntity1.swift in Sources */,
B57D27C41D0BC20100539C58 /* QueryTests.swift in Sources */,

View File

@@ -6,7 +6,7 @@
// Copyright © 2016 John Rommel Estropia. All rights reserved.
//
import UIKit
import Foundation
@testable
import CoreStore

View File

@@ -0,0 +1,280 @@
//
// ListObserverTests.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 XCTest
@testable
import CoreStore
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - ListObserverTests
class ListObserverTests: BaseTestDataTestCase {
@objc
dynamic func test_ThatListObservers_CanReceiveInsertNotifications() {
self.prepareStack { (stack) in
let observer = TestListObserver()
let monitor = stack.monitorSectionedList(
From(TestEntity1),
SectionBy("testBoolean"),
OrderBy(.Ascending("testEntityID"))
)
monitor.addObserver(observer)
XCTAssertFalse(monitor.hasObjects())
XCTAssertFalse(monitor.hasObjectsInSection(0))
XCTAssertTrue(monitor.objectsInAllSections().isEmpty)
var events = 0
let willChangeExpectation = self.expectationForNotification(
"listMonitorWillChange:",
object: observer,
handler: { (note) -> Bool in
XCTAssertEqual((note.userInfo ?? [:]), NSDictionary())
defer {
events += 1
}
return events == 0
}
)
let didInsertSectionExpectation = self.expectationForNotification(
"listMonitor:didInsertSection:toSectionIndex:",
object: observer,
handler: { (note) -> Bool in
XCTAssertEqual(
(note.userInfo ?? [:]),
[
"sectionInfo": monitor.sectionInfoAtIndex(0),
"sectionIndex": 0
] as NSDictionary
)
defer {
events += 1
}
return events == 1
}
)
let didInsertObjectExpectation = self.expectationForNotification(
"listMonitor:didInsertObject:toIndexPath:",
object: observer,
handler: { (note) -> Bool in
let indexPath = note.userInfo?["indexPath"] as? NSIndexPath
XCTAssertEqual(indexPath?.section, 0)
XCTAssertEqual(indexPath?.row, 0)
let object = note.userInfo?["object"] as? TestEntity1
XCTAssertEqual(object?.testBoolean, NSNumber(bool: true))
XCTAssertEqual(object?.testNumber, NSNumber(integer: 1))
XCTAssertEqual(object?.testDecimal, NSDecimalNumber(string: "1"))
XCTAssertEqual(object?.testString, "nil:TestEntity1:1")
XCTAssertEqual(object?.testData, ("nil:TestEntity1:1" as NSString).dataUsingEncoding(NSUTF8StringEncoding)!)
XCTAssertEqual(object?.testDate, self.dateFormatter.dateFromString("2000-01-01T00:00:00Z")!)
defer {
events += 1
}
return events == 2
}
)
let didChangeExpectation = self.expectationForNotification(
"listMonitorDidChange:",
object: observer,
handler: { (note) -> Bool in
XCTAssertEqual((note.userInfo ?? [:]), NSDictionary())
defer {
events += 1
}
return events == 3
}
)
let saveExpectation = self.expectationWithDescription("save")
stack.beginAsynchronous { (transaction) in
let object = transaction.create(Into(TestEntity1))
object.testBoolean = NSNumber(bool: true)
object.testNumber = NSNumber(integer: 1)
object.testDecimal = NSDecimalNumber(string: "1")
object.testString = "nil:TestEntity1:1"
object.testData = ("nil:TestEntity1:1" as NSString).dataUsingEncoding(NSUTF8StringEncoding)!
object.testDate = self.dateFormatter.dateFromString("2000-01-01T00:00:00Z")!
transaction.commit { (result) in
switch result {
case .Success(let hasChanges):
XCTAssertTrue(hasChanges)
saveExpectation.fulfill()
case .Failure:
XCTFail()
}
}
}
self.waitAndCheckExpectations()
}
}
}
// MARK: TestListObserver
class TestListObserver: ListSectionObserver {
// MARK: ListObserver
typealias ListEntityType = TestEntity1
func listMonitorWillChange(monitor: ListMonitor<TestEntity1>) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitorWillChange:",
object: self,
userInfo: [:]
)
}
func listMonitorDidChange(monitor: ListMonitor<TestEntity1>) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitorDidChange:",
object: self,
userInfo: [:]
)
}
func listMonitorWillRefetch(monitor: ListMonitor<TestEntity1>) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitorWillRefetch:",
object: self,
userInfo: [:]
)
}
func listMonitorDidRefetch(monitor: ListMonitor<TestEntity1>) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitorDidRefetch:",
object: self,
userInfo: [:]
)
}
// MARK: ListObjectObserver
func listMonitor(monitor: ListMonitor<TestEntity1>, didInsertObject object: TestEntity1, toIndexPath indexPath: NSIndexPath) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitor:didInsertObject:toIndexPath:",
object: self,
userInfo: [
"object": object,
"indexPath": indexPath
]
)
}
func listMonitor(monitor: ListMonitor<TestEntity1>, didDeleteObject object: TestEntity1, fromIndexPath indexPath: NSIndexPath) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitor:didDeleteObject:fromIndexPath:",
object: self,
userInfo: [
"object": object,
"indexPath": indexPath
]
)
}
func listMonitor(monitor: ListMonitor<TestEntity1>, didUpdateObject object: TestEntity1, atIndexPath indexPath: NSIndexPath) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitor:didUpdateObject:atIndexPath:",
object: self,
userInfo: [
"object": object,
"indexPath": indexPath
]
)
}
func listMonitor(monitor: ListMonitor<TestEntity1>, didMoveObject object: TestEntity1, fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitor:didMoveObject:fromIndexPath:toIndexPath:",
object: self,
userInfo: [
"object": object,
"fromIndexPath": fromIndexPath,
"toIndexPath": toIndexPath
]
)
}
// MARK: ListSectionObserver
func listMonitor(monitor: ListMonitor<TestEntity1>, didInsertSection sectionInfo: NSFetchedResultsSectionInfo, toSectionIndex sectionIndex: Int) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitor:didInsertSection:toSectionIndex:",
object: self,
userInfo: [
"sectionInfo": sectionInfo,
"sectionIndex": sectionIndex
]
)
}
func listMonitor(monitor: ListMonitor<TestEntity1>, didDeleteSection sectionInfo: NSFetchedResultsSectionInfo, fromSectionIndex sectionIndex: Int) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitor:didDeleteSection:fromSectionIndex:",
object: self,
userInfo: [
"sectionInfo": sectionInfo,
"sectionIndex": sectionIndex
]
)
}
}
#endif

View File

@@ -29,9 +29,215 @@ import XCTest
import CoreStore
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - ObjectObserverTests
class ObjectObserverTests: BaseTestDataTestCase {
@objc
dynamic func test_ThatObjectObservers_CanReceiveUpdateNotifications() {
self.prepareStack { (stack) in
self.prepareTestDataForStack(stack, configurations: [nil])
guard let object = stack.fetchOne(
From(TestEntity1),
Where("testEntityID", isEqualTo: 101)) else {
XCTFail()
return
}
let observer = TestObjectObserver()
let monitor = stack.monitorObject(object)
monitor.addObserver(observer)
XCTAssertEqual(monitor.object, object)
XCTAssertFalse(monitor.isObjectDeleted)
var events = 0
let willUpdateExpectation = self.expectationForNotification(
"objectMonitor:willUpdateObject:",
object: observer,
handler: { (note) -> Bool in
XCTAssertEqual(
(note.userInfo ?? [:]),
["object": object] as NSDictionary
)
defer {
events += 1
}
return events == 0
}
)
let didUpdateExpectation = self.expectationForNotification(
"objectMonitor:didUpdateObject:changedPersistentKeys:",
object: observer,
handler: { (note) -> Bool in
XCTAssertEqual(
(note.userInfo ?? [:]),
[
"object": object,
"changedPersistentKeys": Set(
[
"testNumber",
"testString"
]
)
] as NSDictionary
)
let object = note.userInfo?["object"] as? TestEntity1
XCTAssertEqual(object?.testNumber, NSNumber(integer: 10))
XCTAssertEqual(object?.testString, "nil:TestEntity1:10")
defer {
events += 1
}
return events == 1
}
)
let saveExpectation = self.expectationWithDescription("save")
stack.beginAsynchronous { (transaction) in
guard let object = transaction.edit(object) else {
XCTFail()
return
}
object.testNumber = NSNumber(integer: 10)
object.testString = "nil:TestEntity1:10"
transaction.commit { (result) in
switch result {
case .Success(let hasChanges):
XCTAssertTrue(hasChanges)
saveExpectation.fulfill()
case .Failure:
XCTFail()
}
}
}
self.waitAndCheckExpectations()
}
}
@objc
dynamic func test_ThatObjectObservers_CanReceiveDeleteNotifications() {
self.prepareStack { (stack) in
self.prepareTestDataForStack(stack, configurations: [nil])
guard let object = stack.fetchOne(
From(TestEntity1),
Where("testEntityID", isEqualTo: 101)) else {
XCTFail()
return
}
let observer = TestObjectObserver()
let monitor = stack.monitorObject(object)
monitor.addObserver(observer)
XCTAssertEqual(monitor.object, object)
XCTAssertFalse(monitor.isObjectDeleted)
var events = 0
let didDeleteExpectation = self.expectationForNotification(
"objectMonitor:didDeleteObject:",
object: observer,
handler: { (note) -> Bool in
XCTAssertEqual(
(note.userInfo ?? [:]),
["object": object] as NSDictionary
)
defer {
events += 1
}
return events == 0
}
)
let saveExpectation = self.expectationWithDescription("save")
stack.beginAsynchronous { (transaction) in
guard let object = transaction.edit(object) else {
XCTFail()
return
}
transaction.delete(object)
transaction.commit { (result) in
switch result {
case .Success(let hasChanges):
XCTAssertTrue(hasChanges)
XCTAssertTrue(monitor.isObjectDeleted)
saveExpectation.fulfill()
case .Failure:
XCTFail()
}
}
}
self.waitAndCheckExpectations()
}
}
}
// MARK: TestObjectObserver
class TestObjectObserver: ObjectObserver {
typealias ObjectEntityType = TestEntity1
func objectMonitor(monitor: ObjectMonitor<TestEntity1>, willUpdateObject object: TestEntity1) {
NSNotificationCenter.defaultCenter().postNotificationName(
"objectMonitor:willUpdateObject:",
object: self,
userInfo: [
"object": object
]
)
}
func objectMonitor(monitor: ObjectMonitor<TestEntity1>, didUpdateObject object: TestEntity1, changedPersistentKeys: Set<KeyPath>) {
NSNotificationCenter.defaultCenter().postNotificationName(
"objectMonitor:didUpdateObject:changedPersistentKeys:",
object: self,
userInfo: [
"object": object,
"changedPersistentKeys": changedPersistentKeys
]
)
}
func objectMonitor(monitor: ObjectMonitor<TestEntity1>, didDeleteObject object: TestEntity1) {
NSNotificationCenter.defaultCenter().postNotificationName(
"objectMonitor:didDeleteObject:",
object: self,
userInfo: [
"object": object
]
)
}
}
#endif

View File

@@ -207,7 +207,8 @@ class QueryTests: BaseTestDataTestCase {
let from = From<TestEntity1>(configurations)
let queryClauses: [QueryClause] = [
Where("%K > %@", "testNumber", 1)
Where("%K > %@", "testNumber", 1),
OrderBy(.Ascending("testEntityID"))
]
do {

View File

@@ -29,6 +29,8 @@ import XCTest
import CoreStore
#if os(iOS) || os(watchOS) || os(tvOS)
//MARK: - SectionByTests
final class SectionByTests: XCTestCase {
@@ -51,3 +53,5 @@ final class SectionByTests: XCTestCase {
}
}
}
#endif

View File

@@ -1171,6 +1171,8 @@ let person2 = self.monitor[1, 2]
- Swift 2.2 (Xcode 7.3)
- Dependencies:
- [GCDKit](https://github.com/JohnEstropia/GCDKit)
- Other notes:
- The `com.apple.CoreData.ConcurrencyDebug` debug argument should be turned off for the app. CoreStore already guarantees safety for you by making the main context read-only, and by only executing transactions serially.
### Install with CocoaPods (iOS 7 not supported)
```

View File

@@ -27,6 +27,8 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - NSFetchedResultsController
public extension NSFetchedResultsController {
@@ -217,3 +219,5 @@ public extension NSFetchedResultsController {
)
}
}
#endif

View File

@@ -413,7 +413,17 @@ extension Bool: SelectValueResultType {
public static func fromResultObject(result: AnyObject) -> Bool? {
return (result as? NSNumber)?.boolValue
switch result {
case let decimal as NSDecimalNumber:
return NSNumber(double: decimal.doubleValue).boolValue
case let number as NSNumber:
return number.boolValue
default:
return nil
}
}
}

View File

@@ -27,9 +27,10 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - CoreStoreFetchedResultsController
@available(OSX, unavailable)
internal final class CoreStoreFetchedResultsController: NSFetchedResultsController {
// MARK: Internal
@@ -108,3 +109,5 @@ internal final class CoreStoreFetchedResultsController: NSFetchedResultsControll
@nonobjc
private let reapplyAffectedStores: (fetchRequest: NSFetchRequest, context: NSManagedObjectContext) -> Bool
}
#endif

View File

@@ -27,9 +27,10 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - FetchedResultsControllerHandler
@available(OSX, unavailable)
internal protocol FetchedResultsControllerHandler: class {
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?)
@@ -46,7 +47,6 @@ internal protocol FetchedResultsControllerHandler: class {
// MARK: - FetchedResultsControllerDelegate
@available(OSX, unavailable)
internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResultsControllerDelegate {
// MARK: Internal
@@ -229,3 +229,5 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult
@nonobjc
private var insertedSections = Set<Int>()
}
#endif

View File

@@ -68,6 +68,9 @@ internal extension NSManagedObjectContext {
context.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
context.undoManager = nil
context.setupForCoreStoreWithContextName("com.corestore.rootcontext")
#if os(iOS) || os(OSX)
context.observerForDidImportUbiquitousContentChangesNotification = NotificationObserver(
notificationName: NSPersistentStoreDidImportUbiquitousContentChangesNotification,
object: coordinator,
@@ -84,6 +87,9 @@ internal extension NSManagedObjectContext {
}
}
)
#endif
return context
}

View File

@@ -24,6 +24,7 @@
//
import Foundation
import CoreData
// MARK: - AsynchronousDataTransaction
@@ -233,6 +234,8 @@ extension GroupBy: CustomDebugStringConvertible, CoreStoreDebugStringConvertible
}
#if os(iOS) || os(OSX)
// MARK: - ICloudStore
extension ICloudStore: CustomDebugStringConvertible, CoreStoreDebugStringConvertible {
@@ -258,6 +261,8 @@ extension ICloudStore: CustomDebugStringConvertible, CoreStoreDebugStringConvert
)
}
}
#endif
// MARK: - InMemoryStore
@@ -339,6 +344,8 @@ extension LegacySQLiteStore: CustomDebugStringConvertible, CoreStoreDebugStringC
}
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - ListMonitor
private struct CoreStoreFetchedSectionInfoWrapper: CoreStoreDebugStringConvertible {
@@ -377,6 +384,7 @@ extension ListMonitor: CustomDebugStringConvertible, CoreStoreDebugStringConvert
)
}
}
#endif
// MARK: - LocalStorageOptions
@@ -546,6 +554,8 @@ extension MigrationType: CustomDebugStringConvertible, CoreStoreDebugStringConve
}
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - ObjectMonitor
extension ObjectMonitor: CustomDebugStringConvertible, CoreStoreDebugStringConvertible {
@@ -569,7 +579,7 @@ extension ObjectMonitor: CustomDebugStringConvertible, CoreStoreDebugStringConve
)
}
}
#endif
// MARK: - OrderBy
@@ -629,6 +639,8 @@ extension SaveResult: CustomDebugStringConvertible, CoreStoreDebugStringConverti
}
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - SectionBy
extension SectionBy: CustomDebugStringConvertible, CoreStoreDebugStringConvertible {
@@ -651,6 +663,7 @@ extension SectionBy: CustomDebugStringConvertible, CoreStoreDebugStringConvertib
)
}
}
#endif
// MARK: - Select
@@ -1093,7 +1106,7 @@ extension NSEntityDescription: CoreStoreDebugStringConvertible {
("renamingIdentifier", self.renamingIdentifier),
("compoundIndexes", self.compoundIndexes)
]
if #available(iOS 9.0, *) {
if #available(iOS 9.0, OSXApplicationExtension 10.11, *) {
info.append(("uniquenessConstraints", self.uniquenessConstraints))
}

View File

@@ -27,9 +27,10 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - CSCoreStore
@available(OSX, unavailable)
public extension CSCoreStore {
/**
@@ -114,3 +115,5 @@ public extension CSCoreStore {
)
}
}
#endif

View File

@@ -27,9 +27,10 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - CSDataStack
@available(OSX, unavailable)
public extension CSDataStack {
/**
@@ -181,3 +182,5 @@ public extension CSDataStack {
)
}
}
#endif

View File

@@ -27,6 +27,8 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - CSListMonitor
/**
@@ -34,7 +36,6 @@ import CoreData
- SeeAlso: `ListMonitor`
*/
@available(OSX, unavailable)
@objc
public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
@@ -568,3 +569,5 @@ extension ListMonitor: CoreStoreSwiftType {
return CSListMonitor(self)
}
}
#endif

View File

@@ -27,6 +27,8 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - CSListObserver
/**
@@ -40,7 +42,6 @@ import CoreData
- SeeAlso: `ListObserver`
*/
@available(OSX, unavailable)
@objc
public protocol CSListObserver: class, AnyObject {
@@ -91,7 +92,6 @@ public protocol CSListObserver: class, AnyObject {
- SeeAlso: `ListObjectObserver`
*/
@available(OSX, unavailable)
@objc
public protocol CSListObjectObserver: CSListObserver {
@@ -152,7 +152,6 @@ public protocol CSListObjectObserver: CSListObserver {
- SeeAlso: `ListSectionObserver`
*/
@available(OSX, unavailable)
@objc
public protocol CSListSectionObserver: CSListObjectObserver {
@@ -176,3 +175,5 @@ public protocol CSListSectionObserver: CSListObjectObserver {
@objc
optional func listMonitor(monitor: CSListMonitor, didDeleteSection sectionInfo: NSFetchedResultsSectionInfo, fromSectionIndex sectionIndex: Int)
}
#endif

View File

@@ -27,6 +27,8 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - CSObjectMonitor
/**
@@ -34,7 +36,6 @@ import CoreData
- SeeAlso: `ObjectMonitor`
*/
@available(OSX, unavailable)
@objc
public final class CSObjectMonitor: NSObject, CoreStoreObjectiveCType {
@@ -146,3 +147,5 @@ extension ObjectMonitor: CoreStoreSwiftType {
return CSObjectMonitor(self)
}
}
#endif

View File

@@ -27,6 +27,8 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - CSObjectObserver
/**
@@ -38,7 +40,6 @@ import CoreData
- SeeAlso: `ObjectObserver`
*/
@available(OSX, unavailable)
@objc
public protocol CSObjectObserver: class, AnyObject {
@@ -70,3 +71,5 @@ public protocol CSObjectObserver: class, AnyObject {
@objc
optional func objectMonitor(monitor: CSObjectMonitor, didDeleteObject object: AnyObject)
}
#endif

View File

@@ -27,6 +27,8 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - CSSectionBy
/**
@@ -34,7 +36,6 @@ import CoreData
- SeeAlso: `SectionBy`
*/
@available(OSX, unavailable)
@objc
public final class CSSectionBy: NSObject, CoreStoreObjectiveCType {
@@ -92,3 +93,5 @@ extension SectionBy: CoreStoreSwiftType {
public typealias ObjectiveCType = CSSectionBy
}
#endif

View File

@@ -27,9 +27,10 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - NSFetchedResultsController
@available(OSX, unavailable)
public extension NSFetchedResultsController {
/**
@@ -61,3 +62,5 @@ public extension NSFetchedResultsController {
)
}
}
#endif

View File

@@ -27,9 +27,10 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - CoreStore
@available(OSX, unavailable)
public extension CoreStore {
/**
@@ -148,3 +149,5 @@ public extension CoreStore {
self.defaultStack.monitorSectionedList(createAsynchronously: createAsynchronously, from, sectionBy, fetchClauses)
}
}
#endif

View File

@@ -30,9 +30,10 @@ import CoreData
#endif
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - DataStack
@available(OSX, unavailable)
public extension DataStack {
/**
@@ -227,3 +228,5 @@ public extension DataStack {
)
}
}
#endif

View File

@@ -30,6 +30,8 @@ import CoreData
#endif
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - ListMonitor
/**
@@ -69,7 +71,6 @@ import CoreData
```
In the example above, both `person1` and `person2` will contain the object at section=2, index=3.
*/
@available(OSX, unavailable)
public final class ListMonitor<T: NSManagedObject>: Hashable {
// MARK: Public (Accessors)
@@ -1163,41 +1164,35 @@ public final class ListMonitor<T: NSManagedObject>: Hashable {
// MARK: - ListMonitor: Equatable
@available(OSX, unavailable)
@warn_unused_result
public func == <T: NSManagedObject>(lhs: ListMonitor<T>, rhs: ListMonitor<T>) -> Bool {
return lhs === rhs
}
@available(OSX, unavailable)
@warn_unused_result
public func == <T: NSManagedObject, U: NSManagedObject>(lhs: ListMonitor<T>, rhs: ListMonitor<U>) -> Bool {
return lhs.fetchedResultsController === rhs.fetchedResultsController
}
@available(OSX, unavailable)
@warn_unused_result
public func ~= <T: NSManagedObject>(lhs: ListMonitor<T>, rhs: ListMonitor<T>) -> Bool {
return lhs === rhs
}
@available(OSX, unavailable)
@warn_unused_result
public func ~= <T: NSManagedObject, U: NSManagedObject>(lhs: ListMonitor<T>, rhs: ListMonitor<U>) -> Bool {
return lhs.fetchedResultsController === rhs.fetchedResultsController
}
@available(OSX, unavailable)
extension ListMonitor: Equatable { }
// MARK: - ListMonitor: FetchedResultsControllerHandler
@available(OSX, unavailable)
extension ListMonitor: FetchedResultsControllerHandler {
// MARK: FetchedResultsControllerHandler
@@ -1324,3 +1319,5 @@ private let UserInfoKeyNewIndexPath = "UserInfoKeyNewIndexPath"
private let UserInfoKeySectionInfo = "UserInfoKeySectionInfo"
private let UserInfoKeySectionIndex = "UserInfoKeySectionIndex"
#endif

View File

@@ -27,6 +27,8 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - ListObserver
/**
@@ -39,7 +41,6 @@ import CoreData
monitor.addObserver(self)
```
*/
@available(OSX, unavailable)
public protocol ListObserver: class {
/**
@@ -79,7 +80,6 @@ public protocol ListObserver: class {
// MARK: - ListObserver (Default Implementations)
@available(OSX, unavailable)
public extension ListObserver {
/**
@@ -116,7 +116,6 @@ public extension ListObserver {
monitor.addObserver(self)
```
*/
@available(OSX, unavailable)
public protocol ListObjectObserver: ListObserver {
/**
@@ -160,7 +159,6 @@ public protocol ListObjectObserver: ListObserver {
// MARK: - ListObjectObserver (Default Implementations)
@available(OSX, unavailable)
public extension ListObjectObserver {
/**
@@ -198,7 +196,6 @@ public extension ListObjectObserver {
monitor.addObserver(self)
```
*/
@available(OSX, unavailable)
public protocol ListSectionObserver: ListObjectObserver {
/**
@@ -223,7 +220,6 @@ public protocol ListSectionObserver: ListObjectObserver {
// MARK: - ListSectionObserver (Default Implementations)
@available(OSX, unavailable)
public extension ListSectionObserver {
/**
@@ -236,3 +232,5 @@ public extension ListSectionObserver {
*/
func listMonitor(monitor: ListMonitor<ListEntityType>, didDeleteSection sectionInfo: NSFetchedResultsSectionInfo, fromSectionIndex sectionIndex: Int) { }
}
#endif

View File

@@ -30,6 +30,8 @@ import CoreData
#endif
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - ObjectMonitor
/**
@@ -42,7 +44,6 @@ import CoreData
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)
public final class ObjectMonitor<T: NSManagedObject> {
/**
@@ -300,25 +301,21 @@ public final class ObjectMonitor<T: NSManagedObject> {
// MARK: - ObjectMonitor: Equatable
@available(OSX, unavailable)
public func == <T: NSManagedObject>(lhs: ObjectMonitor<T>, rhs: ObjectMonitor<T>) -> Bool {
return lhs === rhs
}
@available(OSX, unavailable)
public func ~= <T: NSManagedObject>(lhs: ObjectMonitor<T>, rhs: ObjectMonitor<T>) -> Bool {
return lhs === rhs
}
@available(OSX, unavailable)
extension ObjectMonitor: Equatable { }
// MARK: - ObjectMonitor: FetchedResultsControllerHandler
@available(OSX, unavailable)
extension ObjectMonitor: FetchedResultsControllerHandler {
// MARK: FetchedResultsControllerHandler
@@ -371,3 +368,4 @@ private let ObjectMonitorDidUpdateObjectNotification = "ObjectMonitorDidUpdateOb
private let UserInfoKeyObject = "UserInfoKeyObject"
#endif

View File

@@ -27,6 +27,8 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - ObjectObserver
/**
@@ -36,7 +38,6 @@ import CoreData
monitor.addObserver(self)
```
*/
@available(OSX, unavailable)
public protocol ObjectObserver: class {
/**
@@ -73,7 +74,6 @@ public protocol ObjectObserver: class {
// MARK: - ObjectObserver (Default Implementations)
@available(OSX, unavailable)
public extension ObjectObserver {
/**
@@ -91,3 +91,5 @@ public extension ObjectObserver {
*/
func objectMonitor(monitor: ObjectMonitor<ObjectEntityType>, didDeleteObject object: ObjectEntityType) { }
}
#endif

View File

@@ -27,6 +27,8 @@ import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - SectionBy
/**
@@ -39,7 +41,6 @@ import CoreData
)
```
*/
@available(OSX, unavailable)
public struct SectionBy {
/**
@@ -71,3 +72,5 @@ public struct SectionBy {
internal let sectionKeyPath: KeyPath
internal let sectionIndexTransformer: (sectionName: KeyPath?) -> String?
}
#endif

View File

@@ -30,9 +30,10 @@ import CoreData
#endif
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - UnsafeDataTransaction
@available(OSX, unavailable)
public extension UnsafeDataTransaction {
/**
@@ -208,3 +209,5 @@ public extension UnsafeDataTransaction {
)
}
}
#endif

View File

@@ -27,6 +27,8 @@ import Foundation
import CoreData
#if os(iOS) || os(OSX)
// MARK: - ICloudStore
/**
@@ -502,3 +504,5 @@ private let ICloudUbiquitousStoreWillRemoveContentNotification = "ICloudUbiquito
private let ICloudUbiquitousStoreDidRemoveContentNotification = "ICloudUbiquitousStoreDidRemoveContentNotification"
private let UserInfoKeyDataStack = "UserInfoKeyDataStack"
#endif

View File

@@ -26,6 +26,8 @@
import Foundation
#if os(iOS) || os(OSX)
// MARK: - ICloudStoreObserver
/**
@@ -120,3 +122,5 @@ public extension ICloudStoreObserver {
public func iCloudStoreDidRemoveContent(storage storage: ICloudStore, dataStack: DataStack) {}
}
#endif

View File

@@ -24,6 +24,7 @@
//
import Foundation
import CoreData
// MARK: - LegacySQLiteStore