From 003bf897e251ab3663ccd4edf8f7a089aaa0621b Mon Sep 17 00:00:00 2001 From: John Estropia Date: Sun, 7 Mar 2021 12:01:08 +0900 Subject: [PATCH] Cleanup unnecessary #available branches --- CoreStore.xcodeproj/project.pbxproj | 4 +- CoreStoreTests/BridgingTests.m | 12 +- CoreStoreTests/ConvenienceTests.swift | 1 - CoreStoreTests/ListObserverTests.swift | 2 - CoreStoreTests/ObjectObserverTests.swift | 2 - CoreStoreTests/ObjectPublisherTests.swift | 1 - CoreStoreTests/SectionByTests.swift | 1 - CoreStoreTests/StorageInterfaceTests.swift | 100 ++++---------- CoreStoreTests/TransactionTests.swift | 2 - Sources/CSDataStack+Observing.swift | 1 - Sources/CSListMonitor.swift | 2 - Sources/CSListObserver.swift | 3 - Sources/CSObjectMonitor.swift | 2 - Sources/CSObjectObserver.swift | 1 - Sources/CSSectionBy.swift | 2 - ...reStore+CustomDebugStringConvertible.swift | 26 +--- Sources/CoreStoreSchema.swift | 49 +++---- Sources/DataStack+Migration.swift | 11 +- Sources/DataStack+Observing.swift | 1 - ...bleDataSource.TableViewAdapter-UIKit.swift | 11 +- Sources/Entity.swift | 2 - Sources/FieldCoders.NSCoding.swift | 27 ++-- Sources/From+Querying.swift | 30 ----- Sources/Internals.CoreStoreFetchRequest.swift | 14 -- ...ls.CoreStoreFetchedResultsController.swift | 1 - ...als.FetchedResultsControllerDelegate.swift | 124 +----------------- Sources/ListMonitor.swift | 5 - Sources/ListObserver.swift | 6 - Sources/ListPublisher.swift | 1 - ...FetchedResultsController+Convenience.swift | 3 - .../NSManagedObjectContext+Transaction.swift | 9 +- Sources/ObjectMonitor.swift | 3 - Sources/ObjectObserver.swift | 2 - Sources/SQLiteStore.swift | 13 +- Sources/SectionBy.swift | 3 - Sources/SectionMonitorBuilder.swift | 2 - Sources/UnsafeDataTransaction+Observing.swift | 1 - 37 files changed, 65 insertions(+), 415 deletions(-) diff --git a/CoreStore.xcodeproj/project.pbxproj b/CoreStore.xcodeproj/project.pbxproj index 9103e4b..f231963 100644 --- a/CoreStore.xcodeproj/project.pbxproj +++ b/CoreStore.xcodeproj/project.pbxproj @@ -3372,7 +3372,7 @@ SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 10.0; + TVOS_DEPLOYMENT_TARGET = 11.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WATCHOS_DEPLOYMENT_TARGET = 3.0; @@ -3436,7 +3436,7 @@ SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 10.0; + TVOS_DEPLOYMENT_TARGET = 11.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; diff --git a/CoreStoreTests/BridgingTests.m b/CoreStoreTests/BridgingTests.m index 853db4e..31040ea 100644 --- a/CoreStoreTests/BridgingTests.m +++ b/CoreStoreTests/BridgingTests.m @@ -191,16 +191,8 @@ XCTAssertEqualObjects([[sqliteStorage class] storeType], [CSSQLiteStore storeType]); XCTAssertEqualObjects([[sqliteStorage class] storeType], NSSQLiteStoreType); XCTAssertNil(sqliteStorage.configuration); - NSDictionary *storeOptions; - if (@available(iOS 11.0, macOS 10.13, tvOS 11.0, *)) { - - storeOptions = @{ NSSQLitePragmasOption: @{ @"journal_mode": @"WAL" }, - NSBinaryStoreInsecureDecodingCompatibilityOption: @YES }; - } - else { - - storeOptions = @{ NSSQLitePragmasOption: @{ @"journal_mode": @"WAL" }}; - } + NSDictionary *storeOptions = @{ NSSQLitePragmasOption: @{ @"journal_mode": @"WAL" }, + NSBinaryStoreInsecureDecodingCompatibilityOption: @YES }; XCTAssertEqualObjects(sqliteStorage.storeOptions, storeOptions); XCTAssertNil(sqliteError); } diff --git a/CoreStoreTests/ConvenienceTests.swift b/CoreStoreTests/ConvenienceTests.swift index 9e7fd2e..d59e463 100644 --- a/CoreStoreTests/ConvenienceTests.swift +++ b/CoreStoreTests/ConvenienceTests.swift @@ -29,7 +29,6 @@ import CoreStore // MARK: - ConvenienceTests -@available(macOS 10.12, *) class ConvenienceTests: BaseTestCase { @objc diff --git a/CoreStoreTests/ListObserverTests.swift b/CoreStoreTests/ListObserverTests.swift index ac1bb5a..e3c5c86 100644 --- a/CoreStoreTests/ListObserverTests.swift +++ b/CoreStoreTests/ListObserverTests.swift @@ -31,7 +31,6 @@ import CoreStore // MARK: - ListObserverTests -@available(macOS 10.12, *) class ListObserverTests: BaseTestDataTestCase { @objc @@ -551,7 +550,6 @@ class ListObserverTests: BaseTestDataTestCase { // MARK: TestListObserver -@available(macOS 10.12, *) class TestListObserver: ListSectionObserver { // MARK: ListObserver diff --git a/CoreStoreTests/ObjectObserverTests.swift b/CoreStoreTests/ObjectObserverTests.swift index 4072916..8ca76d3 100644 --- a/CoreStoreTests/ObjectObserverTests.swift +++ b/CoreStoreTests/ObjectObserverTests.swift @@ -31,7 +31,6 @@ import CoreStore // MARK: - ObjectObserverTests -@available(macOS 10.12, *) class ObjectObserverTests: BaseTestDataTestCase { @objc @@ -203,7 +202,6 @@ class ObjectObserverTests: BaseTestDataTestCase { // MARK: TestObjectObserver -@available(macOS 10.12, *) class TestObjectObserver: ObjectObserver { typealias ObjectEntityType = TestEntity1 diff --git a/CoreStoreTests/ObjectPublisherTests.swift b/CoreStoreTests/ObjectPublisherTests.swift index 58d4817..b6ff73a 100644 --- a/CoreStoreTests/ObjectPublisherTests.swift +++ b/CoreStoreTests/ObjectPublisherTests.swift @@ -31,7 +31,6 @@ import CoreStore // MARK: - ObjectPublisherTests -@available(macOS 10.12, *) class ObjectPublisherTests: BaseTestDataTestCase { @objc diff --git a/CoreStoreTests/SectionByTests.swift b/CoreStoreTests/SectionByTests.swift index a0711e3..fc4d031 100644 --- a/CoreStoreTests/SectionByTests.swift +++ b/CoreStoreTests/SectionByTests.swift @@ -31,7 +31,6 @@ import CoreStore //MARK: - SectionByTests -@available(macOS 10.12, *) final class SectionByTests: XCTestCase { @objc diff --git a/CoreStoreTests/StorageInterfaceTests.swift b/CoreStoreTests/StorageInterfaceTests.swift index ef94b85..f00f81e 100644 --- a/CoreStoreTests/StorageInterfaceTests.swift +++ b/CoreStoreTests/StorageInterfaceTests.swift @@ -83,21 +83,11 @@ final class StorageInterfaceTests: XCTestCase { let store = SQLiteStore() XCTAssertEqual(type(of: store).storeType, NSSQLiteStoreType) XCTAssertNil(store.configuration) - if #available(iOS 11.0, macOS 10.13, tvOS 11.0, *) { - - XCTAssertEqual( - store.storeOptions as NSDictionary?, - [NSSQLitePragmasOption: ["journal_mode": "WAL"], - NSBinaryStoreInsecureDecodingCompatibilityOption: true] as NSDictionary - ) - } - else { - - XCTAssertEqual( - store.storeOptions as NSDictionary?, - [NSSQLitePragmasOption: ["journal_mode": "WAL"]] as NSDictionary - ) - } + XCTAssertEqual( + store.storeOptions as NSDictionary?, + [NSSQLitePragmasOption: ["journal_mode": "WAL"], + NSBinaryStoreInsecureDecodingCompatibilityOption: true] as NSDictionary + ) XCTAssertEqual(store.fileURL, SQLiteStore.defaultFileURL) XCTAssertTrue(store.migrationMappingProviders.isEmpty) @@ -123,21 +113,11 @@ final class StorageInterfaceTests: XCTestCase { ) XCTAssertEqual(type(of: store).storeType, NSSQLiteStoreType) XCTAssertEqual(store.configuration, "config1") - if #available(iOS 11.0, macOS 10.13, tvOS 11.0, *) { - - XCTAssertEqual( - store.storeOptions as NSDictionary?, - [NSSQLitePragmasOption: ["journal_mode": "WAL"], - NSBinaryStoreInsecureDecodingCompatibilityOption: true] as NSDictionary - ) - } - else { - - XCTAssertEqual( - store.storeOptions as NSDictionary?, - [NSSQLitePragmasOption: ["journal_mode": "WAL"]] as NSDictionary - ) - } + XCTAssertEqual( + store.storeOptions as NSDictionary?, + [NSSQLitePragmasOption: ["journal_mode": "WAL"], + NSBinaryStoreInsecureDecodingCompatibilityOption: true] as NSDictionary + ) XCTAssertEqual(store.fileURL, fileURL) XCTAssertEqual(store.migrationMappingProviders as! [XcodeSchemaMappingProvider], [mappingProvider]) @@ -160,21 +140,11 @@ final class StorageInterfaceTests: XCTestCase { ) XCTAssertEqual(type(of: store).storeType, NSSQLiteStoreType) XCTAssertEqual(store.configuration, "config1") - if #available(iOS 11.0, macOS 10.13, tvOS 11.0, *) { - - XCTAssertEqual( - store.storeOptions as NSDictionary?, - [NSSQLitePragmasOption: ["journal_mode": "WAL"], - NSBinaryStoreInsecureDecodingCompatibilityOption: true] as NSDictionary - ) - } - else { - - XCTAssertEqual( - store.storeOptions as NSDictionary?, - [NSSQLitePragmasOption: ["journal_mode": "WAL"]] as NSDictionary - ) - } + XCTAssertEqual( + store.storeOptions as NSDictionary?, + [NSSQLitePragmasOption: ["journal_mode": "WAL"], + NSBinaryStoreInsecureDecodingCompatibilityOption: true] as NSDictionary + ) XCTAssertEqual(store.fileURL.deletingLastPathComponent(), SQLiteStore.defaultRootDirectory) XCTAssertEqual(store.fileURL.lastPathComponent, fileName) @@ -209,21 +179,11 @@ final class StorageInterfaceTests: XCTestCase { let store = SQLiteStore.legacy() XCTAssertEqual(type(of: store).storeType, NSSQLiteStoreType) XCTAssertNil(store.configuration) - if #available(iOS 11.0, macOS 10.13, tvOS 11.0, *) { - - XCTAssertEqual( - store.storeOptions as NSDictionary?, - [NSSQLitePragmasOption: ["journal_mode": "WAL"], - NSBinaryStoreInsecureDecodingCompatibilityOption: true] as NSDictionary - ) - } - else { - - XCTAssertEqual( - store.storeOptions as NSDictionary?, - [NSSQLitePragmasOption: ["journal_mode": "WAL"]] as NSDictionary - ) - } + XCTAssertEqual( + store.storeOptions as NSDictionary?, + [NSSQLitePragmasOption: ["journal_mode": "WAL"], + NSBinaryStoreInsecureDecodingCompatibilityOption: true] as NSDictionary + ) XCTAssertEqual(store.fileURL, SQLiteStore.legacyDefaultFileURL) XCTAssertTrue(store.migrationMappingProviders.isEmpty) @@ -246,21 +206,11 @@ final class StorageInterfaceTests: XCTestCase { ) XCTAssertEqual(type(of: store).storeType, NSSQLiteStoreType) XCTAssertEqual(store.configuration, "config1") - if #available(iOS 11.0, macOS 10.13, tvOS 11.0, *) { - - XCTAssertEqual( - store.storeOptions as NSDictionary?, - [NSSQLitePragmasOption: ["journal_mode": "WAL"], - NSBinaryStoreInsecureDecodingCompatibilityOption: true] as NSDictionary - ) - } - else { - - XCTAssertEqual( - store.storeOptions as NSDictionary?, - [NSSQLitePragmasOption: ["journal_mode": "WAL"]] as NSDictionary - ) - } + XCTAssertEqual( + store.storeOptions as NSDictionary?, + [NSSQLitePragmasOption: ["journal_mode": "WAL"], + NSBinaryStoreInsecureDecodingCompatibilityOption: true] as NSDictionary + ) XCTAssertEqual(store.fileURL.deletingLastPathComponent(), SQLiteStore.legacyDefaultRootDirectory) XCTAssertEqual(store.fileURL.lastPathComponent, fileName) diff --git a/CoreStoreTests/TransactionTests.swift b/CoreStoreTests/TransactionTests.swift index 2477569..d06a18e 100644 --- a/CoreStoreTests/TransactionTests.swift +++ b/CoreStoreTests/TransactionTests.swift @@ -383,8 +383,6 @@ final class TransactionTests: BaseTestCase { } } - - @available(macOS 10.12, *) @objc dynamic func test_ThatSynchronousTransactions_CanCommitWithoutWaitingForMerges() { diff --git a/Sources/CSDataStack+Observing.swift b/Sources/CSDataStack+Observing.swift index 78c0141..d0c2ff4 100644 --- a/Sources/CSDataStack+Observing.swift +++ b/Sources/CSDataStack+Observing.swift @@ -30,7 +30,6 @@ import CoreData // MARK: - CSDataStack @available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.") -@available(macOS 10.12, *) extension CSDataStack { /** diff --git a/Sources/CSListMonitor.swift b/Sources/CSListMonitor.swift index a5b3fae..f4a5d67 100644 --- a/Sources/CSListMonitor.swift +++ b/Sources/CSListMonitor.swift @@ -34,7 +34,6 @@ import CoreData - SeeAlso: `ListMonitor` */ -@available(macOS 10.12, *) @objc public final class CSListMonitor: NSObject { @@ -546,7 +545,6 @@ public final class CSListMonitor: NSObject { // MARK: - ListMonitor -@available(macOS 10.12, *) extension ListMonitor where ListMonitor.ObjectType: NSManagedObject { // MARK: CoreStoreSwiftType diff --git a/Sources/CSListObserver.swift b/Sources/CSListObserver.swift index b12c3f4..8c48e7f 100644 --- a/Sources/CSListObserver.swift +++ b/Sources/CSListObserver.swift @@ -40,7 +40,6 @@ import CoreData - SeeAlso: `ListObserver` */ -@available(macOS 10.12, *) @objc public protocol CSListObserver: AnyObject { @@ -91,7 +90,6 @@ public protocol CSListObserver: AnyObject { - SeeAlso: `ListObjectObserver` */ -@available(macOS 10.12, *) @objc public protocol CSListObjectObserver: CSListObserver { @@ -152,7 +150,6 @@ public protocol CSListObjectObserver: CSListObserver { - SeeAlso: `ListSectionObserver` */ -@available(macOS 10.12, *) @objc public protocol CSListSectionObserver: CSListObjectObserver { diff --git a/Sources/CSObjectMonitor.swift b/Sources/CSObjectMonitor.swift index a0e7561..41f78c5 100644 --- a/Sources/CSObjectMonitor.swift +++ b/Sources/CSObjectMonitor.swift @@ -34,7 +34,6 @@ import CoreData - SeeAlso: `ObjectMonitor` */ -@available(macOS 10.12, *) @objc public final class CSObjectMonitor: NSObject { @@ -139,7 +138,6 @@ public final class CSObjectMonitor: NSObject { // MARK: - ObjectMonitor -@available(macOS 10.12, *) extension ObjectMonitor where ObjectMonitor.ObjectType: NSManagedObject { // MARK: CoreStoreSwiftType diff --git a/Sources/CSObjectObserver.swift b/Sources/CSObjectObserver.swift index a69e968..3490882 100644 --- a/Sources/CSObjectObserver.swift +++ b/Sources/CSObjectObserver.swift @@ -38,7 +38,6 @@ import CoreData - SeeAlso: `ObjectObserver` */ -@available(macOS 10.12, *) @objc public protocol CSObjectObserver: AnyObject { diff --git a/Sources/CSSectionBy.swift b/Sources/CSSectionBy.swift index 0755cf6..b7363c6 100644 --- a/Sources/CSSectionBy.swift +++ b/Sources/CSSectionBy.swift @@ -34,7 +34,6 @@ import CoreData - SeeAlso: `SectionBy` */ -@available(macOS 10.12, *) @objc public final class CSSectionBy: NSObject { @@ -91,7 +90,6 @@ public final class CSSectionBy: NSObject { // MARK: - SectionBy -@available(macOS 10.12, *) extension SectionBy { // MARK: CoreStoreSwiftType diff --git a/Sources/CoreStore+CustomDebugStringConvertible.swift b/Sources/CoreStore+CustomDebugStringConvertible.swift index 32aa7c5..ff56e49 100644 --- a/Sources/CoreStore+CustomDebugStringConvertible.swift +++ b/Sources/CoreStore+CustomDebugStringConvertible.swift @@ -359,7 +359,6 @@ extension UnsafeDataModelSchema: CustomDebugStringConvertible, CoreStoreDebugStr // MARK: - ListMonitor -@available(macOS 10.12, *) fileprivate struct CoreStoreFetchedSectionInfoWrapper: CoreStoreDebugStringConvertible { // MARK: CustomDebugStringConvertible @@ -404,7 +403,6 @@ fileprivate struct CoreStoreFetchedSectionInfoWrapper: CoreStoreDebugStringConve private let numberOfObjects: Int } -@available(macOS 10.12, *) extension ListMonitor: CustomDebugStringConvertible, CoreStoreDebugStringConvertible { // MARK: CustomDebugStringConvertible @@ -431,7 +429,6 @@ extension ListMonitor: CustomDebugStringConvertible, CoreStoreDebugStringConvert // MARK: - ListPublisher -@available(macOS 10.12, *) extension ListPublisher: CustomDebugStringConvertible, CoreStoreDebugStringConvertible { // MARK: CustomDebugStringConvertible @@ -614,7 +611,6 @@ extension MigrationType: CoreStoreDebugStringConvertible { // MARK: - ObjectMonitor -@available(macOS 10.12, *) extension ObjectMonitor: CustomDebugStringConvertible, CoreStoreDebugStringConvertible { // MARK: CustomDebugStringConvertible @@ -738,7 +734,6 @@ extension PartialObject: CustomDebugStringConvertible, CoreStoreDebugStringConve // MARK: - SectionBy -@available(macOS 10.12, *) extension SectionBy: CustomDebugStringConvertible, CoreStoreDebugStringConvertible { // MARK: CustomDebugStringConvertible @@ -1259,33 +1254,20 @@ extension NSEntityDescription: CoreStoreDebugStringConvertible { public var coreStoreDumpString: String { - var info: DumpInfo = [ + return createFormattedString( + "(", ")", ("managedObjectClassName", self.managedObjectClassName!), ("name", self.name as Any), + ("indexes", self.indexes), ("isAbstract", self.isAbstract), ("superentity?.name", self.superentity?.name as Any), ("subentities", self.subentities.map({ $0.name })), ("properties", self.properties), + ("uniquenessConstraints", self.uniquenessConstraints), ("userInfo", self.userInfo as Any), ("versionHash", self.versionHash), ("versionHashModifier", self.versionHashModifier as Any), ("renamingIdentifier", self.renamingIdentifier as Any) - ] - if #available(iOS 11.0, macOS 10.13, watchOS 4.0, tvOS 11.0, *) { - - info.append(("indexes", self.indexes)) - } - else { - - info.append(("compoundIndexes", self.compoundIndexes)) - } - if #available(macOS 10.11, iOS 9.0, *) { - - info.append(("uniquenessConstraints", self.uniquenessConstraints)) - } - return createFormattedString( - "(", ")", - info ) } } diff --git a/Sources/CoreStoreSchema.swift b/Sources/CoreStoreSchema.swift index 7c976f3..98150f5 100644 --- a/Sources/CoreStoreSchema.swift +++ b/Sources/CoreStoreSchema.swift @@ -564,18 +564,14 @@ public final class CoreStoreSchema: DynamicSchema { ) } for (entity, entityDescription) in entityDescriptionsByEntity { + + if entity.uniqueConstraints.contains(where: { !$0.isEmpty }) { - if #available(macOS 10.11, iOS 9.0, *) { - - let uniqueConstraints = entity.uniqueConstraints.filter({ !$0.isEmpty }) - if !uniqueConstraints.isEmpty { - - Internals.assert( - entityDescription.superentity == nil, - "Uniqueness constraints must be defined at the highest level possible." - ) - entityDescription.uniquenessConstraints = entity.uniqueConstraints.map { $0.map { $0 as NSString } } - } + Internals.assert( + entityDescription.superentity == nil, + "Uniqueness constraints must be defined at the highest level possible." + ) + entityDescription.uniquenessConstraints = entity.uniqueConstraints.map { $0.map { $0 as NSString } } } guard !entity.indexes.isEmpty else { @@ -586,31 +582,18 @@ public final class CoreStoreSchema: DynamicSchema { entityDescription.coreStoreEntity = entity // reserialize } let attributesByName = entityDescription.attributesByName - if #available(iOS 11.0, macOS 10.13, watchOS 4.0, tvOS 11.0, *) { + entityDescription.indexes = entity.indexes.map { (compoundIndexes) in - entityDescription.indexes = entity.indexes.map { (compoundIndexes) in - - return NSFetchIndexDescription.init( - name: "_CoreStoreSchema_indexes_\(entityDescription.name!)_\(compoundIndexes.joined(separator: "-"))", - elements: compoundIndexes.map { (keyPath) in - - return NSFetchIndexElementDescription( - property: attributesByName[keyPath]!, - collationType: .binary - ) - } - ) - } - } - else { - - entityDescription.compoundIndexes = entity.indexes.map { (compoundIndexes) in - - return compoundIndexes.map { (keyPath) in + return NSFetchIndexDescription.init( + name: "_CoreStoreSchema_indexes_\(entityDescription.name!)_\(compoundIndexes.joined(separator: "-"))", + elements: compoundIndexes.map { (keyPath) in - return attributesByName[keyPath]! + return NSFetchIndexElementDescription( + property: attributesByName[keyPath]!, + collationType: .binary + ) } - } + ) } } } diff --git a/Sources/DataStack+Migration.swift b/Sources/DataStack+Migration.swift index 68a797d..856e376 100644 --- a/Sources/DataStack+Migration.swift +++ b/Sources/DataStack+Migration.swift @@ -613,16 +613,7 @@ extension DataStack { } } let fileManager = FileManager.default - let systemTemporaryDirectoryURL: URL - if #available(macOS 10.12, iOS 10.0, *) { - - systemTemporaryDirectoryURL = fileManager.temporaryDirectory - } - else { - - systemTemporaryDirectoryURL = URL(fileURLWithPath: NSTemporaryDirectory()) - } - let temporaryDirectoryURL = systemTemporaryDirectoryURL + let temporaryDirectoryURL = fileManager.temporaryDirectory .appendingPathComponent(Bundle.main.bundleIdentifier ?? "com.CoreStore.DataStack") .appendingPathComponent(ProcessInfo().globallyUniqueString) diff --git a/Sources/DataStack+Observing.swift b/Sources/DataStack+Observing.swift index 8c7adba..f4bc077 100644 --- a/Sources/DataStack+Observing.swift +++ b/Sources/DataStack+Observing.swift @@ -29,7 +29,6 @@ import CoreData // MARK: - DataStack -@available(macOS 10.12, *) extension DataStack { /** diff --git a/Sources/DiffableDataSource.TableViewAdapter-UIKit.swift b/Sources/DiffableDataSource.TableViewAdapter-UIKit.swift index c390202..88a6ad9 100644 --- a/Sources/DiffableDataSource.TableViewAdapter-UIKit.swift +++ b/Sources/DiffableDataSource.TableViewAdapter-UIKit.swift @@ -247,16 +247,7 @@ extension DiffableDataSource { return } - if #available(iOS 11.0, tvOS 11.0, *) { - - base.performBatchUpdates(updates) - } - else { - - base.beginUpdates() - updates() - base.endUpdates() - } + base.performBatchUpdates(updates) } public func reloadData() { diff --git a/Sources/Entity.swift b/Sources/Entity.swift index 6845763..fe7f787 100644 --- a/Sources/Entity.swift +++ b/Sources/Entity.swift @@ -70,7 +70,6 @@ public final class Entity: DynamicEntity { - parameter indexes: the compound indexes for the entity as an array of arrays. The arrays contained in the returned array contain `KeyPath`s to properties of the entity. - parameter uniqueConstraints: sets uniqueness constraints for the entity. A uniqueness constraint is a set of one or more `KeyPath`s whose value must be unique over the set of instances of that entity. This value forms part of the entity's version hash. Uniqueness constraint violations can be computationally expensive to handle. It is highly suggested that there be only one uniqueness constraint per entity hierarchy. Uniqueness constraints must be defined at the highest level possible, and CoreStore will raise an assertion failure if unique constraints are added to a sub entity. */ - @available(macOS 10.11, *) public convenience init(_ entityName: String, isAbstract: Bool = false, versionHashModifier: String? = nil, indexes: [[PartialKeyPath]] = [], uniqueConstraints: [[PartialKeyPath]]) { self.init( @@ -116,7 +115,6 @@ public final class Entity: DynamicEntity { - parameter indexes: the compound indexes for the entity as an array of arrays. The arrays contained in the returned array contain KeyPath's to properties of the entity. - parameter uniqueConstraints: sets uniqueness constraints for the entity. A uniqueness constraint is a set of one or more `KeyPath`s whose value must be unique over the set of instances of that entity. This value forms part of the entity's version hash. Uniqueness constraint violations can be computationally expensive to handle. It is highly suggested that there be only one uniqueness constraint per entity hierarchy. Uniqueness constraints must be defined at the highest level possible, and CoreStore will raise an assertion failure if unique constraints are added to a sub entity. */ - @available(macOS 10.11, *) public init(_ type: O.Type, _ entityName: String, isAbstract: Bool = false, versionHashModifier: String? = nil, indexes: [[PartialKeyPath]] = [], uniqueConstraints: [[PartialKeyPath]]) { let meta = O.meta diff --git a/Sources/FieldCoders.NSCoding.swift b/Sources/FieldCoders.NSCoding.swift index 6e57afc..abb4f77 100644 --- a/Sources/FieldCoders.NSCoding.swift +++ b/Sources/FieldCoders.NSCoding.swift @@ -47,17 +47,10 @@ extension FieldCoders { return nil } - if #available(iOS 11.0, macOS 10.13, watchOS 4.0, tvOS 11.0, *) { - - return try! NSKeyedArchiver.archivedData( - withRootObject: fieldValue, - requiringSecureCoding: self.requiresSecureCoding - ) - } - else { - - return NSKeyedArchiver.archivedData(withRootObject: fieldValue) - } + return try! NSKeyedArchiver.archivedData( + withRootObject: fieldValue, + requiringSecureCoding: self.requiresSecureCoding + ) } public static func decodeFromStoredData(_ data: Data?) -> FieldStoredValue? { @@ -66,14 +59,10 @@ extension FieldCoders { return nil } - if #available(iOS 11.0, macOS 10.13, watchOS 4.0, tvOS 11.0, *) { - - return try! NSKeyedUnarchiver.unarchivedObject(ofClass: FieldStoredValue.self, from: data) - } - else { - - return NSKeyedUnarchiver.unarchiveObject(with: data) as! FieldStoredValue? - } + return try! NSKeyedUnarchiver.unarchivedObject( + ofClass: FieldStoredValue.self, + from: data + ) } diff --git a/Sources/From+Querying.swift b/Sources/From+Querying.swift index 0d9a4d6..d092e1b 100644 --- a/Sources/From+Querying.swift +++ b/Sources/From+Querying.swift @@ -221,7 +221,6 @@ extension From { - parameter clause: the `SectionBy` to be used by the `ListMonitor` - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy(_ clause: SectionBy) -> SectionMonitorChainBuilder { return .init( @@ -237,7 +236,6 @@ extension From { - parameter sectionKeyPath: the key path to use to group the objects into sections - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy(_ sectionKeyPath: KeyPathString) -> SectionMonitorChainBuilder { return self.sectionBy(sectionKeyPath, sectionIndexTransformer: { _ in nil }) @@ -251,7 +249,6 @@ extension From { - parameter sectionIndexTransformer: a closure to transform the value for the key path to an appropriate section index title - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPathString, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -284,7 +281,6 @@ extension From { // MARK: Deprecated @available(*, deprecated, renamed: "sectionBy(_:sectionIndexTransformer:)") - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPathString, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -319,7 +315,6 @@ extension From where O: NSManagedObject { - parameter sectionKeyPath: the `KeyPath` to use to group the objects into sections - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy(_ sectionKeyPath: KeyPath) -> SectionMonitorChainBuilder { return self.sectionBy( @@ -336,7 +331,6 @@ extension From where O: NSManagedObject { - parameter sectionIndexTransformer: a closure to transform the value for the key path to an appropriate section index title - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -352,7 +346,6 @@ extension From where O: NSManagedObject { // MARK: Deprecated @available(*, deprecated, renamed: "sectionBy(_:sectionIndexTransformer:)") - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -431,7 +424,6 @@ extension From where O: CoreStoreObject { - parameter sectionKeyPath: the `KeyPath` to use to group the objects into sections - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy(_ sectionKeyPath: KeyPath.Stored>) -> SectionMonitorChainBuilder { return self.sectionBy( @@ -446,7 +438,6 @@ extension From where O: CoreStoreObject { - parameter sectionKeyPath: the `KeyPath` to use to group the objects into sections - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy(_ sectionKeyPath: KeyPath.Virtual>) -> SectionMonitorChainBuilder { return self.sectionBy( @@ -461,7 +452,6 @@ extension From where O: CoreStoreObject { - parameter sectionKeyPath: the `KeyPath` to use to group the objects into sections - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy(_ sectionKeyPath: KeyPath.Coded>) -> SectionMonitorChainBuilder { return self.sectionBy( @@ -476,7 +466,6 @@ extension From where O: CoreStoreObject { - parameter sectionKeyPath: the `KeyPath` to use to group the objects into sections - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy(_ sectionKeyPath: KeyPath.Required>) -> SectionMonitorChainBuilder { return self.sectionBy( @@ -491,7 +480,6 @@ extension From where O: CoreStoreObject { - parameter sectionKeyPath: the `KeyPath` to use to group the objects into sections - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy(_ sectionKeyPath: KeyPath.Optional>) -> SectionMonitorChainBuilder { return self.sectionBy( @@ -506,7 +494,6 @@ extension From where O: CoreStoreObject { - parameter sectionKeyPath: the `KeyPath` to use to group the objects into sections - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy(_ sectionKeyPath: KeyPath.Required>) -> SectionMonitorChainBuilder { return self.sectionBy( @@ -521,7 +508,6 @@ extension From where O: CoreStoreObject { - parameter sectionKeyPath: the `KeyPath` to use to group the objects into sections - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy(_ sectionKeyPath: KeyPath.Optional>) -> SectionMonitorChainBuilder { return self.sectionBy( @@ -538,7 +524,6 @@ extension From where O: CoreStoreObject { - parameter sectionIndexTransformer: a closure to transform the value for the key path to an appropriate section index title - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Stored>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -558,7 +543,6 @@ extension From where O: CoreStoreObject { - parameter sectionIndexTransformer: a closure to transform the value for the key path to an appropriate section index title - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Virtual>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -578,7 +562,6 @@ extension From where O: CoreStoreObject { - parameter sectionIndexTransformer: a closure to transform the value for the key path to an appropriate section index title - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Coded>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -598,7 +581,6 @@ extension From where O: CoreStoreObject { - parameter sectionIndexTransformer: a closure to transform the value for the key path to an appropriate section index title - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Required>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -618,7 +600,6 @@ extension From where O: CoreStoreObject { - parameter sectionIndexTransformer: a closure to transform the value for the key path to an appropriate section index title - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Optional>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -638,7 +619,6 @@ extension From where O: CoreStoreObject { - parameter sectionIndexTransformer: a closure to transform the value for the key path to an appropriate section index title - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Required>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -658,7 +638,6 @@ extension From where O: CoreStoreObject { - parameter sectionIndexTransformer: a closure to transform the value for the key path to an appropriate section index title - returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path */ - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Optional>, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -674,7 +653,6 @@ extension From where O: CoreStoreObject { // MARK: Deprecated @available(*, deprecated, renamed: "sectionBy(_:sectionIndexTransformer:)") - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Stored>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -687,7 +665,6 @@ extension From where O: CoreStoreObject { } @available(*, deprecated, renamed: "sectionBy(_:sectionIndexTransformer:)") - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Virtual>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -700,7 +677,6 @@ extension From where O: CoreStoreObject { } @available(*, deprecated, renamed: "sectionBy(_:sectionIndexTransformer:)") - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Coded>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -713,7 +689,6 @@ extension From where O: CoreStoreObject { } @available(*, deprecated, renamed: "sectionBy(_:sectionIndexTransformer:)") - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Required>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -726,7 +701,6 @@ extension From where O: CoreStoreObject { } @available(*, deprecated, renamed: "sectionBy(_:sectionIndexTransformer:)") - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Optional>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -739,7 +713,6 @@ extension From where O: CoreStoreObject { } @available(*, deprecated, renamed: "sectionBy(_:sectionIndexTransformer:)") - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Required>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -752,7 +725,6 @@ extension From where O: CoreStoreObject { } @available(*, deprecated, renamed: "sectionBy(_:sectionIndexTransformer:)") - @available(macOS 10.12, *) public func sectionBy( _ sectionKeyPath: KeyPath.Optional>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String? @@ -1224,7 +1196,6 @@ extension QueryChainBuilder where O: CoreStoreObject { // MARK: - SectionMonitorChainBuilder -@available(macOS 10.12, *) extension SectionMonitorChainBuilder { /** @@ -1376,7 +1347,6 @@ extension SectionMonitorChainBuilder { // MARK: - SectionMonitorChainBuilder where O: CoreStoreObject -@available(macOS 10.12, *) extension SectionMonitorChainBuilder where O: CoreStoreObject { /** diff --git a/Sources/Internals.CoreStoreFetchRequest.swift b/Sources/Internals.CoreStoreFetchRequest.swift index aaf43f7..d0e8f55 100644 --- a/Sources/Internals.CoreStoreFetchRequest.swift +++ b/Sources/Internals.CoreStoreFetchRequest.swift @@ -68,22 +68,8 @@ extension Internals { } set { - if #available(iOS 11.0, macOS 10.13, watchOS 4.0, tvOS 11.0, *) { - - self.copiedAffectedStores = (newValue as NSArray?)?.copy() as! NSArray? - super.affectedStores = newValue - return - } - // Bugfix for NSFetchRequest messing up memory management for `affectedStores` - // http://stackoverflow.com/questions/14396375/nsfetchedresultscontroller-crashes-in-ios-6-if-affectedstores-is-specified - if let releaseArray = self.releaseArray { - - releaseArray.release() - self.releaseArray = nil - } self.copiedAffectedStores = (newValue as NSArray?)?.copy() as! NSArray? super.affectedStores = newValue - self.releaseArray = (super.affectedStores as NSArray?).map(Unmanaged.passRetained(_:)) } } diff --git a/Sources/Internals.CoreStoreFetchedResultsController.swift b/Sources/Internals.CoreStoreFetchedResultsController.swift index 699b7db..bda6c6f 100644 --- a/Sources/Internals.CoreStoreFetchedResultsController.swift +++ b/Sources/Internals.CoreStoreFetchedResultsController.swift @@ -33,7 +33,6 @@ extension Internals { // MARK: - CoreStoreFetchedResultsController - @available(macOS 10.12, *) internal final class CoreStoreFetchedResultsController: NSFetchedResultsController { // MARK: Internal diff --git a/Sources/Internals.FetchedResultsControllerDelegate.swift b/Sources/Internals.FetchedResultsControllerDelegate.swift index 4cfec36..2931ee0 100644 --- a/Sources/Internals.FetchedResultsControllerDelegate.swift +++ b/Sources/Internals.FetchedResultsControllerDelegate.swift @@ -29,7 +29,6 @@ import CoreData // MARK: - FetchedResultsControllerHandler -@available(macOS 10.12, *) internal protocol FetchedResultsControllerHandler: AnyObject { var sectionIndexTransformer: (_ sectionName: KeyPathString?) -> String? { get } @@ -50,7 +49,6 @@ extension Internals { // MARK: - FetchedResultsControllerDelegate - @available(macOS 10.12, *) internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResultsControllerDelegate { // MARK: Internal @@ -90,14 +88,6 @@ extension Internals { return } - - if #available(iOS 10.3, tvOS 10.3, watchOS 3.2, macOS 10.13, *) {} - else { - - self.deletedSections = [] - self.insertedSections = [] - } - self.handler?.controllerWillChangeContent(controller) } @@ -123,102 +113,11 @@ extension Internals { return } - - if #available(iOS 10.3, tvOS 10.3, watchOS 3.2, macOS 10.13, *) { - - self.handler?.controller( - controller, - didChangeObject: anObject, - atIndexPath: indexPath, - forChangeType: type, - newIndexPath: newIndexPath - ) - return - } - - guard var actualType = NSFetchedResultsChangeType(rawValue: type.rawValue) else { - - // This fix is for a bug where iOS passes 0 for NSFetchedResultsChangeType, but this is not a valid enum case. - // Swift will then always execute the first case of the switch causing strange behaviour. - // https://forums.developer.apple.com/thread/12184#31850 - return - } - - // This whole dance is a workaround for a nasty bug introduced in XCode 7 targeted at iOS 8 devices - // http://stackoverflow.com/questions/31383760/ios-9-attempt-to-delete-and-reload-the-same-index-path/31384014#31384014 - // https://forums.developer.apple.com/message/9998#9998 - // https://forums.developer.apple.com/message/31849#31849 - - if case .update = actualType, - indexPath != nil, - newIndexPath != nil { - - actualType = .move - } - - switch actualType { - - case .update: - guard let section = indexPath?[0] else { - - return - } - if self.deletedSections.contains(section) - || self.insertedSections.contains(section) { - - return - } - - case .move: - guard let indexPath = indexPath, let newIndexPath = newIndexPath else { - - return - } - guard indexPath == newIndexPath else { - - break - } - if self.insertedSections.contains(indexPath[0]) { - - // Observers that handle the .Move change are advised to delete then reinsert the object instead of just moving. This is especially true when indexPath and newIndexPath are equal. For example, calling tableView.moveRowAtIndexPath(_:toIndexPath) when both indexPaths are the same will crash the tableView. - self.handler?.controller( - controller, - didChangeObject: anObject, - atIndexPath: indexPath, - forChangeType: .move, - newIndexPath: newIndexPath - ) - return - } - if self.deletedSections.contains(indexPath[0]) { - - self.handler?.controller( - controller, - didChangeObject: anObject, - atIndexPath: nil, - forChangeType: .insert, - newIndexPath: indexPath - ) - return - } - self.handler?.controller( - controller, - didChangeObject: anObject, - atIndexPath: indexPath, - forChangeType: .update, - newIndexPath: nil - ) - return - - default: - break - } - self.handler?.controller( controller, didChangeObject: anObject, atIndexPath: indexPath, - forChangeType: actualType, + forChangeType: type, newIndexPath: newIndexPath ) } @@ -230,18 +129,6 @@ extension Internals { return } - - if #available(iOS 10.3, tvOS 10.3, watchOS 3.2, macOS 10.13, *) {} - else { - - switch type { - - case .delete: self.deletedSections.insert(sectionIndex) - case .insert: self.insertedSections.insert(sectionIndex) - default: break - } - } - self.handler?.controller( controller, didChangeSection: sectionInfo, @@ -255,14 +142,5 @@ extension Internals { return self.handler?.sectionIndexTransformer(sectionName) } - - - // MARK: Private - - @nonobjc - private var deletedSections = Set() - - @nonobjc - private var insertedSections = Set() } } diff --git a/Sources/ListMonitor.swift b/Sources/ListMonitor.swift index 168a448..79e0789 100644 --- a/Sources/ListMonitor.swift +++ b/Sources/ListMonitor.swift @@ -66,7 +66,6 @@ import CoreData ``` In the example above, both `person1` and `person2` will contain the object at section=2, index=3. */ -@available(macOS 10.12, *) public final class ListMonitor: Hashable { // MARK: Public (Accessors) @@ -1178,7 +1177,6 @@ public final class ListMonitor: Hashable { // MARK: - ListMonitor where O: NSManagedObject -@available(macOS 10.12, *) extension ListMonitor where O: NSManagedObject { /** @@ -1236,7 +1234,6 @@ extension ListMonitor where O: NSManagedObject { // MARK: - ListMonitor where O: CoreStoreObject -@available(macOS 10.12, *) extension ListMonitor where O: CoreStoreObject { /** @@ -1288,7 +1285,6 @@ extension ListMonitor where O: CoreStoreObject { // MARK: - ListMonitor: FetchedResultsControllerHandler -@available(macOS 10.12, *) extension ListMonitor: FetchedResultsControllerHandler { // MARK: FetchedResultsControllerHandler @@ -1402,7 +1398,6 @@ extension ListMonitor: FetchedResultsControllerHandler { // MARK: - Notification Keys -@available(macOS 10.12, *) extension Notification.Name { fileprivate static let listMonitorWillChangeList = Notification.Name(rawValue: "listMonitorWillChangeList") diff --git a/Sources/ListObserver.swift b/Sources/ListObserver.swift index 820767e..ff6f256 100644 --- a/Sources/ListObserver.swift +++ b/Sources/ListObserver.swift @@ -39,7 +39,6 @@ import CoreData monitor.addObserver(self) ``` */ -@available(macOS 10.12, *) public protocol ListObserver: AnyObject { /** @@ -82,7 +81,6 @@ public protocol ListObserver: AnyObject { // MARK: - ListObserver (Default Implementations) -@available(macOS 10.12, *) extension ListObserver { public func listMonitorWillChange(_ monitor: ListMonitor) { } @@ -103,7 +101,6 @@ extension ListObserver { monitor.addObserver(self) ``` */ -@available(macOS 10.12, *) public protocol ListObjectObserver: ListObserver { /** @@ -151,7 +148,6 @@ public protocol ListObjectObserver: ListObserver { // MARK: - ListObjectObserver (Default Implementations) -@available(macOS 10.12, *) extension ListObjectObserver { public func listMonitor(_ monitor: ListMonitor, didInsertObject object: ListEntityType, toIndexPath indexPath: IndexPath) { } @@ -177,7 +173,6 @@ extension ListObjectObserver { monitor.addObserver(self) ``` */ -@available(macOS 10.12, *) public protocol ListSectionObserver: ListObjectObserver { /** @@ -204,7 +199,6 @@ public protocol ListSectionObserver: ListObjectObserver { // MARK: - ListSectionObserver (Default Implementations) -@available(macOS 10.12, *) extension ListSectionObserver { public func listMonitor(_ monitor: ListMonitor, didInsertSection sectionInfo: NSFetchedResultsSectionInfo, toSectionIndex sectionIndex: Int) { } diff --git a/Sources/ListPublisher.swift b/Sources/ListPublisher.swift index 0ac296b..9a35e4f 100644 --- a/Sources/ListPublisher.swift +++ b/Sources/ListPublisher.swift @@ -54,7 +54,6 @@ import CoreData ``` All access to the `ListPublisher` items should be done via its `snapshot` value, which is a `struct` of type `ListSnapshot`. `ListSnapshot`s are also designed to work well with `DiffableDataSource.TableViewAdapter`s and `DiffableDataSource.CollectionViewAdapter`s. For detailed examples, refer to the documentation for `DiffableDataSource.TableViewAdapter` and `DiffableDataSource.CollectionViewAdapter`. */ -@available(macOS 10.12, *) public final class ListPublisher: Hashable { // MARK: Public (Accessors) diff --git a/Sources/NSFetchedResultsController+Convenience.swift b/Sources/NSFetchedResultsController+Convenience.swift index e94c291..7e53430 100644 --- a/Sources/NSFetchedResultsController+Convenience.swift +++ b/Sources/NSFetchedResultsController+Convenience.swift @@ -29,7 +29,6 @@ import CoreData // MARK: - DataStack -@available(macOS 10.12, *) extension DataStack { /** @@ -114,7 +113,6 @@ extension DataStack { // MARK: - UnsafeDataTransaction -@available(macOS 10.12, *) extension UnsafeDataTransaction { /** @@ -204,7 +202,6 @@ extension Internals { // MARK: FilePrivate - @available(macOS 10.12, *) fileprivate static func createFRC(fromContext context: NSManagedObjectContext, from: From, sectionBy: SectionBy? = nil, fetchClauses: [FetchClause]) -> NSFetchedResultsController { let controller = Internals.CoreStoreFetchedResultsController( diff --git a/Sources/NSManagedObjectContext+Transaction.swift b/Sources/NSManagedObjectContext+Transaction.swift index 4c5ad1c..4bbcdb5 100644 --- a/Sources/NSManagedObjectContext+Transaction.swift +++ b/Sources/NSManagedObjectContext+Transaction.swift @@ -230,14 +230,7 @@ extension NSManagedObjectContext { @nonobjc internal func refreshAndMergeAllObjects() { - if #available(iOS 8.3, macOS 10.11, *) { - - self.refreshAllObjects() - } - else { - - self.registeredObjects.forEach { self.refresh($0, mergeChanges: true) } - } + self.refreshAllObjects() } diff --git a/Sources/ObjectMonitor.swift b/Sources/ObjectMonitor.swift index d550b25..dcc9c1b 100644 --- a/Sources/ObjectMonitor.swift +++ b/Sources/ObjectMonitor.swift @@ -39,7 +39,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(macOS 10.12, *) public final class ObjectMonitor: Hashable, ObjectRepresentation { /** @@ -376,7 +375,6 @@ public final class ObjectMonitor: Hashable, ObjectRepresentati // MARK: - ObjectMonitor: FetchedResultsControllerHandler -@available(macOS 10.12, *) extension ObjectMonitor: FetchedResultsControllerHandler { // MARK: FetchedResultsControllerHandler @@ -426,7 +424,6 @@ extension ObjectMonitor: FetchedResultsControllerHandler { // MARK: - Notification.Name -@available(macOS 10.12, *) extension Notification.Name { fileprivate static let objectMonitorWillChangeObject = Notification.Name(rawValue: "objectMonitorWillChangeObject") diff --git a/Sources/ObjectObserver.swift b/Sources/ObjectObserver.swift index e0cfbac..f2fa9cb 100644 --- a/Sources/ObjectObserver.swift +++ b/Sources/ObjectObserver.swift @@ -36,7 +36,6 @@ import CoreData monitor.addObserver(self) ``` */ -@available(macOS 10.12, *) public protocol ObjectObserver: AnyObject { /** @@ -76,7 +75,6 @@ public protocol ObjectObserver: AnyObject { // MARK: - ObjectObserver (Default Implementations) -@available(macOS 10.12, *) extension ObjectObserver { public func objectMonitor(_ monitor: ObjectMonitor, willUpdateObject object: ObjectEntityType) { } diff --git a/Sources/SQLiteStore.swift b/Sources/SQLiteStore.swift index a469ea4..f8d2abc 100644 --- a/Sources/SQLiteStore.swift +++ b/Sources/SQLiteStore.swift @@ -150,15 +150,10 @@ public final class SQLiteStore: LocalStorage { [NSSQLitePragmasOption: ["journal_mode": "WAL"]] ``` */ - public let storeOptions: [AnyHashable: Any]? = autoreleasepool { - - var storeOptions: [AnyHashable: Any] = [NSSQLitePragmasOption: ["journal_mode": "WAL"]] - if #available(iOS 11.0, macOS 10.13, tvOSApplicationExtension 11.0, watchOSApplicationExtension 4.0, *) { - - storeOptions[NSBinaryStoreInsecureDecodingCompatibilityOption] = true - } - return storeOptions - } + public let storeOptions: [AnyHashable: Any]? = [ + NSSQLitePragmasOption: ["journal_mode": "WAL"], + NSBinaryStoreInsecureDecodingCompatibilityOption: true + ] /** Do not call directly. Used by the `DataStack` internally. diff --git a/Sources/SectionBy.swift b/Sources/SectionBy.swift index 43e624c..0765945 100644 --- a/Sources/SectionBy.swift +++ b/Sources/SectionBy.swift @@ -39,7 +39,6 @@ import CoreData ) ``` */ -@available(macOS 10.12, *) public struct SectionBy { /** @@ -99,7 +98,6 @@ public struct SectionBy { // MARK: - SectionBy where O: NSManagedObject -@available(macOS 10.12, *) extension SectionBy where O: NSManagedObject { /** @@ -152,7 +150,6 @@ extension SectionBy where O: NSManagedObject { // MARK: - SectionBy where O: CoreStoreObject -@available(macOS 10.12, *) extension SectionBy where O: CoreStoreObject { /** diff --git a/Sources/SectionMonitorBuilder.swift b/Sources/SectionMonitorBuilder.swift index 173e07d..de1efd3 100644 --- a/Sources/SectionMonitorBuilder.swift +++ b/Sources/SectionMonitorBuilder.swift @@ -40,7 +40,6 @@ import CoreData ) ``` */ -@available(macOS 10.12, *) public struct SectionMonitorChainBuilder: SectionMonitorBuilderType { // MARK: SectionMonitorBuilderType @@ -62,7 +61,6 @@ public struct SectionMonitorChainBuilder: SectionMonitorBuilde /** Utility protocol for `SectionMonitorChainBuilder`. Used in methods that support chained fetch builders. */ -@available(macOS 10.12, *) public protocol SectionMonitorBuilderType { /** diff --git a/Sources/UnsafeDataTransaction+Observing.swift b/Sources/UnsafeDataTransaction+Observing.swift index 389df8e..bd22faf 100644 --- a/Sources/UnsafeDataTransaction+Observing.swift +++ b/Sources/UnsafeDataTransaction+Observing.swift @@ -29,7 +29,6 @@ import CoreData // MARK: - UnsafeDataTransaction -@available(macOS 10.12, *) extension UnsafeDataTransaction { /**