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

@@ -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