From 2b3ee08f2140e5852c61349edfb804f40c7c081e Mon Sep 17 00:00:00 2001 From: Adam Lickel Date: Wed, 6 Mar 2024 09:50:49 -0800 Subject: [PATCH 1/7] Linter / formatter cleanup --- .swiftformat | 2 +- .../xcshareddata/swiftpm/Package.resolved | 7 +- .../AssociatedValueReference.swift | 9 ++- .../Controller/FetchedResultsController.swift | 17 +++-- .../FetchedResultsControllerProtocol.swift | 4 +- FetchRequests/Sources/JSON.swift | 72 +++++++++---------- ...ionsFetchedResultsControllerTestCase.swift | 19 +++-- .../FetchedResultsControllerTestCase.swift | 6 ++ ...tingFetchedResultsControllerTestCase.swift | 6 ++ ...ableFetchedResultsControllerTestCase.swift | 6 ++ 10 files changed, 85 insertions(+), 63 deletions(-) diff --git a/.swiftformat b/.swiftformat index bd03f82..b007b6c 100644 --- a/.swiftformat +++ b/.swiftformat @@ -1,4 +1,4 @@ ---swiftversion 5.7 +--swiftversion 5.9 --exclude Pods diff --git a/FetchRequests.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/FetchRequests.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 45f2ba8..eb48177 100644 --- a/FetchRequests.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/FetchRequests.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,14 +1,15 @@ { + "originHash" : "51f90653b2c9f9f7064c0d52159b40bf7d222e5f314be23e62fe28520fec03db", "pins" : [ { "identity" : "swift-collections", "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-collections.git", "state" : { - "revision" : "f504716c27d2e5d4144fa4794b12129301d17729", - "version" : "1.0.3" + "revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb", + "version" : "1.1.0" } } ], - "version" : 2 + "version" : 3 } diff --git a/FetchRequests/Sources/Associations/AssociatedValueReference.swift b/FetchRequests/Sources/Associations/AssociatedValueReference.swift index 6a025e6..319fe63 100644 --- a/FetchRequests/Sources/Associations/AssociatedValueReference.swift +++ b/FetchRequests/Sources/Associations/AssociatedValueReference.swift @@ -24,13 +24,12 @@ class FetchableAssociatedValueReference: AssociatedValu } fileprivate override func startObservingValue() { - let entities: [Entity] - if let value = value as? Entity { - entities = [value] + let entities: [Entity] = if let value = value as? Entity { + [value] } else if let value = value as? [Entity] { - entities = value + value } else { - entities = [] + [] } for entity in entities { diff --git a/FetchRequests/Sources/Controller/FetchedResultsController.swift b/FetchRequests/Sources/Controller/FetchedResultsController.swift index 5e5cd08..fe4b072 100644 --- a/FetchRequests/Sources/Controller/FetchedResultsController.swift +++ b/FetchRequests/Sources/Controller/FetchedResultsController.swift @@ -28,19 +28,19 @@ public enum FetchedResultsChange: Equatable { public static func == (lhs: FetchedResultsChange, rhs: FetchedResultsChange) -> Bool { switch (lhs, rhs) { case let (.insert(left), .insert(right)): - return left == right + left == right case let (.delete(left), .delete(right)): - return left == right + left == right case let (.update(left), .update(right)): - return left == right + left == right case let (.move(leftFrom, leftTo), .move(rightFrom, rightTo)): - return leftFrom == rightFrom && leftTo == rightTo + leftFrom == rightFrom && leftTo == rightTo case (.insert, _), (.update, _), (.delete, _), (.move, _): - return false + false } } } @@ -1075,11 +1075,10 @@ private extension FetchedResultsController { guard let keyPath = sort.key, keyPath != "self" else { continue } - let isSectionNameKeyPath: Bool - if sectionNameKeyPath != nil, index == 0 { - isSectionNameKeyPath = true + let isSectionNameKeyPath: Bool = if sectionNameKeyPath != nil, index == 0 { + true } else { - isSectionNameKeyPath = false + false } let observation = LegacyKeyValueObserving( diff --git a/FetchRequests/Sources/Controller/FetchedResultsControllerProtocol.swift b/FetchRequests/Sources/Controller/FetchedResultsControllerProtocol.swift index bab0ca1..6b86786 100644 --- a/FetchRequests/Sources/Controller/FetchedResultsControllerProtocol.swift +++ b/FetchRequests/Sources/Controller/FetchedResultsControllerProtocol.swift @@ -68,9 +68,9 @@ public extension FetchedResultsControllerProtocol { return sections.binarySearch { if descriptor.ascending { - return $0.name < name + $0.name < name } else { - return $0.name > name + $0.name > name } } } diff --git a/FetchRequests/Sources/JSON.swift b/FetchRequests/Sources/JSON.swift index 32db750..e51fd0d 100644 --- a/FetchRequests/Sources/JSON.swift +++ b/FetchRequests/Sources/JSON.swift @@ -69,22 +69,22 @@ extension JSON { get { switch self { case let .string(value): - return value + value case let .number(value): - return value + value case let .dictionary(value): - return value + value case let .array(value): - return value + value case let .bool(value): - return value + value case .null: - return NSNull() + NSNull() } } set { @@ -192,25 +192,25 @@ extension JSON: Equatable { public static func == (lhs: JSON, rhs: JSON) -> Bool { switch (lhs, rhs) { case let (.string(lhs), .string(rhs)): - return lhs == rhs + lhs == rhs case let (.dictionary(lhs), .dictionary(rhs)): - return (lhs as NSDictionary) == (rhs as NSDictionary) + (lhs as NSDictionary) == (rhs as NSDictionary) case let (.array(lhs), .array(rhs)): - return (lhs as NSArray) == (rhs as NSArray) + (lhs as NSArray) == (rhs as NSArray) case let (.number(lhs), .number(rhs)): - return lhs == rhs + lhs == rhs case let (.bool(lhs), .bool(rhs)): - return lhs == rhs + lhs == rhs case (.null, .null): - return true + true case (.string, _), (.dictionary, _), (.array, _), (.number, _), (.bool, _), (.null, _): - return false + false } } } @@ -246,13 +246,13 @@ extension JSON: Collection { public static func < (lhs: Index, rhs: Index) -> Bool { switch (lhs, rhs) { case let (.array(lhs), .array(rhs)): - return lhs < rhs + lhs < rhs case let (.dictionary(lhs), .dictionary(rhs)): - return lhs < rhs + lhs < rhs case (.array, _), (.dictionary, _), (.value, _): - return false + false } } @@ -264,65 +264,65 @@ extension JSON: Collection { public var count: Int { switch self { case let .array(array): - return array.count + array.count case let .dictionary(dictionary): - return dictionary.count + dictionary.count case .string, .number, .bool, .null: - return 1 + 1 } } public var startIndex: Index { switch self { case let .array(array): - return .array(array.startIndex) + .array(array.startIndex) case let .dictionary(dictionary): - return .dictionary(dictionary.startIndex) + .dictionary(dictionary.startIndex) case .string, .number, .bool, .null: - return .value(isStart: true) + .value(isStart: true) } } public var endIndex: Index { switch self { case let .array(array): - return .array(array.endIndex) + .array(array.endIndex) case let .dictionary(dictionary): - return .dictionary(dictionary.endIndex) + .dictionary(dictionary.endIndex) case .string, .number, .bool, .null: - return .value(isStart: false) + .value(isStart: false) } } public func index(after index: Index) -> Index { switch index { case let .array(index): - return .array(array!.index(after: index)) + .array(array!.index(after: index)) case let .dictionary(index): - return .dictionary(dictionary!.index(after: index)) + .dictionary(dictionary!.index(after: index)) case .value: - return .value(isStart: false) + .value(isStart: false) } } private func key(for index: Index) -> Index.Key { switch index { case let .array(index): - return .offset(index) + .offset(index) case let .dictionary(index): - return .key(dictionary![index].key) + .key(dictionary![index].key) case let .value(isStart): - return .value(isStart: isStart) + .value(isStart: isStart) } } @@ -550,11 +550,11 @@ private extension NSNumber { var expectedType: NumberType { if isBool { - return .boolean + .boolean } else if isFloatingPoint { - return .floatingPoint + .floatingPoint } else { - return .integer + .integer } } @@ -614,9 +614,9 @@ extension NSNull: JSONConvertible { extension NSNumber: JSONConvertible { public func jsonRepresentation() -> JSON { if self.isBool { - return .bool(boolValue) + .bool(boolValue) } else { - return .number(self) + .number(self) } } } diff --git a/FetchRequests/Tests/Controllers/CollapsibleSectionsFetchedResultsControllerTestCase.swift b/FetchRequests/Tests/Controllers/CollapsibleSectionsFetchedResultsControllerTestCase.swift index c0faaba..d716219 100644 --- a/FetchRequests/Tests/Controllers/CollapsibleSectionsFetchedResultsControllerTestCase.swift +++ b/FetchRequests/Tests/Controllers/CollapsibleSectionsFetchedResultsControllerTestCase.swift @@ -55,12 +55,17 @@ class CollapsibleSectionsFetchedResultsControllerTestCase: XCTestCase { override func setUp() { super.setUp() + + cleanup() } override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() + cleanup() + } + + private func cleanup() { controller = nil fetchCompletion = nil associationRequest = nil @@ -135,9 +140,9 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { }, sectionConfigCheck: { section in if section.name == "0" { - return SectionCollapseConfig(maxNumberOfItemsToDisplay: maxNumberOfItems) + SectionCollapseConfig(maxNumberOfItemsToDisplay: maxNumberOfItems) } else { - return nil + nil } } ) @@ -166,9 +171,9 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { }, sectionConfigCheck: { section in if section.name == "0" { - return SectionCollapseConfig(maxNumberOfItemsToDisplay: maxNumberOfItems) + SectionCollapseConfig(maxNumberOfItemsToDisplay: maxNumberOfItems) } else { - return nil + nil } } ) @@ -280,9 +285,9 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { }, sectionConfigCheck: { section in if section.name == "0" { - return SectionCollapseConfig(maxNumberOfItemsToDisplay: 3) + SectionCollapseConfig(maxNumberOfItemsToDisplay: 3) } else { - return nil + nil } } ) diff --git a/FetchRequests/Tests/Controllers/FetchedResultsControllerTestCase.swift b/FetchRequests/Tests/Controllers/FetchedResultsControllerTestCase.swift index 2470f03..be0940c 100644 --- a/FetchRequests/Tests/Controllers/FetchedResultsControllerTestCase.swift +++ b/FetchRequests/Tests/Controllers/FetchedResultsControllerTestCase.swift @@ -51,11 +51,17 @@ class FetchedResultsControllerTestCase: XCTestCase, FetchedResultsControllerTest override func setUp() { super.setUp() + + cleanup() } override func tearDown() { super.tearDown() + cleanup() + } + + private func cleanup() { controller = nil fetchCompletion = nil associationRequest = nil diff --git a/FetchRequests/Tests/Controllers/PaginatingFetchedResultsControllerTestCase.swift b/FetchRequests/Tests/Controllers/PaginatingFetchedResultsControllerTestCase.swift index 2cb4cbf..d425911 100644 --- a/FetchRequests/Tests/Controllers/PaginatingFetchedResultsControllerTestCase.swift +++ b/FetchRequests/Tests/Controllers/PaginatingFetchedResultsControllerTestCase.swift @@ -58,11 +58,17 @@ class PaginatingFetchedResultsControllerTestCase: XCTestCase, FetchedResultsCont override func setUp() { super.setUp() + + cleanup() } override func tearDown() { super.tearDown() + cleanup() + } + + private func cleanup() { controller = nil fetchCompletion = nil paginationCurrentResults = nil diff --git a/FetchRequests/Tests/Controllers/PausableFetchedResultsControllerTestCase.swift b/FetchRequests/Tests/Controllers/PausableFetchedResultsControllerTestCase.swift index fb71a7a..8a36205 100644 --- a/FetchRequests/Tests/Controllers/PausableFetchedResultsControllerTestCase.swift +++ b/FetchRequests/Tests/Controllers/PausableFetchedResultsControllerTestCase.swift @@ -50,11 +50,17 @@ class PausableFetchedResultsControllerTestCase: XCTestCase, FetchedResultsContro override func setUp() { super.setUp() + + cleanup() } override func tearDown() { super.tearDown() + cleanup() + } + + private func cleanup() { controller = nil fetchCompletion = nil associationRequest = nil From 22b283ebc58b473542134546e5c570d5e0115d50 Mon Sep 17 00:00:00 2001 From: Adam Lickel Date: Wed, 6 Mar 2024 09:55:10 -0800 Subject: [PATCH 2/7] Move @MainActor annotation for tests --- .../xcshareddata/swiftpm/Package.resolved | 24 +++++------ .../xcshareddata/swiftpm/Package.resolved | 3 +- ...ionsFetchedResultsControllerTestCase.swift | 42 ++++++++++++++++++- .../FetchedResultsControllerTestCase.swift | 40 +++++++++++++++++- .../FetchRequestAssociationTestCase.swift | 14 ++++++- .../SwiftUI/FetchableRequestTestCase.swift | 3 +- 6 files changed, 107 insertions(+), 19 deletions(-) diff --git a/Example/iOS-Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example/iOS-Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index e56059c..1a0f425 100644 --- a/Example/iOS-Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Example/iOS-Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,16 +1,14 @@ { - "object": { - "pins": [ - { - "package": "swift-collections", - "repositoryURL": "https://github.com/apple/swift-collections.git", - "state": { - "branch": null, - "revision": "48254824bb4248676bf7ce56014ff57b142b77eb", - "version": "1.0.2" - } + "pins" : [ + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections.git", + "state" : { + "revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb", + "version" : "1.1.0" } - ] - }, - "version": 1 + } + ], + "version" : 2 } diff --git a/FetchRequests.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/FetchRequests.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index eb48177..1a0f425 100644 --- a/FetchRequests.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/FetchRequests.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,4 @@ { - "originHash" : "51f90653b2c9f9f7064c0d52159b40bf7d222e5f314be23e62fe28520fec03db", "pins" : [ { "identity" : "swift-collections", @@ -11,5 +10,5 @@ } } ], - "version" : 3 + "version" : 2 } diff --git a/FetchRequests/Tests/Controllers/CollapsibleSectionsFetchedResultsControllerTestCase.swift b/FetchRequests/Tests/Controllers/CollapsibleSectionsFetchedResultsControllerTestCase.swift index d716219..d65b631 100644 --- a/FetchRequests/Tests/Controllers/CollapsibleSectionsFetchedResultsControllerTestCase.swift +++ b/FetchRequests/Tests/Controllers/CollapsibleSectionsFetchedResultsControllerTestCase.swift @@ -9,7 +9,6 @@ import XCTest @testable import FetchRequests -@MainActor // swiftlint:disable:next type_name class CollapsibleSectionsFetchedResultsControllerTestCase: XCTestCase { private typealias FetchController = CollapsibleSectionsFetchedResultsController @@ -97,6 +96,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase: CollapsibleSectio // MARK: - Collapse/Expand Tests extension CollapsibleSectionsFetchedResultsControllerTestCase { + @MainActor func testInitialSectionCollapse() throws { controller = FetchController( definition: createFetchDefinition(), @@ -113,6 +113,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertTrue(controller.sections[0].isCollapsed) } + @MainActor func testHidingSection() throws { try testInitialSectionCollapse() let sectionToCollapse = controller.sections[1] @@ -121,6 +122,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertTrue(updatedSection.isCollapsed) } + @MainActor func testExpandingSection() throws { try testInitialSectionCollapse() let sectionToExpand = controller.sections[0] @@ -129,6 +131,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertFalse(updatedSection.isCollapsed) } + @MainActor func testInitialSectionConfigCheck() throws { let maxNumberOfItems = 4 controller = FetchController( @@ -160,6 +163,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[0].displayableObjects.count, 6) } + @MainActor func testSectionUpdatesWhenCollapsed() throws { let maxNumberOfItems = 4 controller = FetchController( @@ -200,6 +204,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(sectionChangeEvents[0].change, FetchedResultsChange.update(location: 0)) } + @MainActor func testObjectUpdatesAfterExpanding() throws { controller = FetchController( definition: createFetchDefinition(), @@ -233,6 +238,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(sectionChangeEvents.count, 0) } + @MainActor func testNumberOfItemsToShowWhenExceedingMax() throws { try testInitialSectionCollapse() controller.expand(section: controller.sections[0]) @@ -243,6 +249,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[0].displayableObjects.count, 3) } + @MainActor func testIndexPath() throws { controller = FetchController( definition: createFetchDefinition(), @@ -267,6 +274,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { } // Test hidden item is not found + @MainActor func testIndexPathNilFromCollapse() throws { try testIndexPath() @@ -275,6 +283,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertNil(indexPath) } + @MainActor func testItemMovingSections() throws { controller = FetchController( definition: createFetchDefinition(), @@ -333,6 +342,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(sectionChangeEvents.count, 1) } + @MainActor func testInsertingItemsTriggersCollapse() throws { controller = FetchController( definition: createFetchDefinition(), @@ -385,6 +395,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(sectionChangeEvents[0].change, FetchedResultsChange.update(location: 0)) } + @MainActor func testDeletingItemsTriggersExpansion() throws { try testInsertingItemsTriggersCollapse() @@ -431,6 +442,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { // MARK: - FetchedResultsControllerTestCase Tests extension CollapsibleSectionsFetchedResultsControllerTestCase { + @MainActor func testBasicFetch() throws { controller = FetchController( definition: createFetchDefinition(), @@ -449,6 +461,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[0].allObjects.count, 5) } + @MainActor func testResort() throws { controller = FetchController( definition: createFetchDefinition(), @@ -465,6 +478,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[0].allFetchedIDs, objectIDs.reversed()) } + @MainActor func testAccessByIndexPath() throws { try testBasicFetch() @@ -484,6 +498,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(lastIndexPath, fetchedLastIndexPath) } + @MainActor func testFetchAvoidsReplacingInstances() throws { controller = FetchController( definition: createFetchDefinition(), @@ -516,6 +531,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[0].allTags, [3, 0, 2, 6, 7]) } + @MainActor func testBasicFetchWithSortDescriptors() throws { controller = FetchController( definition: createFetchDefinition(), @@ -541,6 +557,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { // MARK: - Sections extension CollapsibleSectionsFetchedResultsControllerTestCase { + @MainActor func testFetchingIntoSections() throws { controller = FetchController( definition: createFetchDefinition(), @@ -563,6 +580,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[2].allObjects, [objects[0]]) } + @MainActor func testFetchingIntoSectionsAndAccessingByIndexPath() throws { try testFetchingIntoSections() @@ -587,6 +605,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(lastIndexPath, fetchedLastIndexPath) } + @MainActor func testFetchingIntoSectionsAvoidsReplacingInstances() throws { controller = FetchController( definition: createFetchDefinition(), @@ -634,6 +653,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[1].allTags, [6, 1, 2]) } + @MainActor func testFetchingIntoSectionsWithSortDescriptors() throws { controller = FetchController( definition: createFetchDefinition(), @@ -666,6 +686,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { // MARK: - Associated Values extension CollapsibleSectionsFetchedResultsControllerTestCase { + @MainActor func testFetchingAssociatedObjects() throws { controller = FetchController( definition: createFetchDefinition(associations: [\TestObject.tag]), @@ -717,6 +738,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { } #if canImport(UIKit) && !os(watchOS) + @MainActor func testAssociatedValuesAreDumpedOnMemoryPressure() throws { controller = FetchController( definition: createFetchDefinition(associations: [\TestObject.tag]), @@ -754,6 +776,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { } #endif + @MainActor func testAssociatedObjectsInvalidatedFromKVO() throws { controller = FetchController( definition: createFetchDefinition(associations: [\TestObject.tag]), @@ -791,6 +814,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(tagString2, "2") } + @MainActor func testMissingAssociatedObjectsInvalidatedFromNotifications() throws { controller = FetchController( definition: createFetchDefinition(associations: [\TestObject.tagID]), @@ -848,6 +872,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { } extension CollapsibleSectionsFetchedResultsControllerTestCase { + @MainActor private func setupControllerForKVO(_ file: StaticString = #file, line: UInt = #line) throws { controller = FetchController( definition: createFetchDefinition(), @@ -879,6 +904,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[2].allFetchedIDs, ["c", "d"], file: file, line: line) } + @MainActor func testSectionChangeFromKVO() throws { try setupControllerForKVO() @@ -896,6 +922,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[2].allFetchedIDs, ["d"]) } + @MainActor func testSectionCreationFromKVO() throws { try setupControllerForKVO() @@ -914,6 +941,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[3].allFetchedIDs, ["z"]) } + @MainActor func testSectionDeletionFromKVO() throws { try setupControllerForKVO() @@ -930,6 +958,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[1].allFetchedIDs, ["c", "b", "d"]) } + @MainActor func testOrderChangeFromKVO() throws { try setupControllerForKVO() @@ -944,6 +973,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[2].allFetchedIDs, ["c", "d"]) } + @MainActor func testDeleteFromKVO() throws { controller = FetchController(definition: createFetchDefinition(), debounceInsertsAndReloads: false) controller.setDelegate(self) @@ -965,6 +995,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(changeEvents[0].object.id, "a") } + @MainActor func testAssociatedObjectDeleteFromKVO() throws { controller = FetchController( definition: createFetchDefinition(associations: [\TestObject.tagID]), @@ -1013,6 +1044,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertNil(associationRequest) } + @MainActor func testAssociatedObjectArrayDeleteFromKVO() throws { controller = FetchController( definition: createFetchDefinition(associations: [\TestObject.tagIDs]), @@ -1061,6 +1093,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertNil(associationRequest) } + @MainActor func testExpectNoReloadFromKVO() throws { // We need a custom controller so that sort descriptors is "empty" controller = FetchController( @@ -1095,6 +1128,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[2].allFetchedIDs, ["c", "d"]) } + @MainActor func testExpectReloadFromKVO() throws { controller = FetchController(definition: createFetchDefinition(), debounceInsertsAndReloads: false) controller.setDelegate(self) @@ -1112,6 +1146,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertEqual(changeEvents[0].object.id, "a") } + @MainActor func testExpectReloadFromAssociatedObjectKVO() throws { controller = FetchController( definition: createFetchDefinition(associations: [\TestObject.tagID]), @@ -1160,6 +1195,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertNil(associationRequest) } + @MainActor func testExpectReloadFromAssociatedObjectArrayKVO() throws { controller = FetchController( definition: createFetchDefinition(associations: [\TestObject.tagIDs]), @@ -1208,6 +1244,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssertNil(associationRequest) } + @MainActor func testExpectInsertFromBroadcastNotification() throws { controller = FetchController( definition: createFetchDefinition(), @@ -1245,6 +1282,7 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { XCTAssert(changeEvents.isEmpty) } + @MainActor func testExpectNoInsertFromBroadcastNotification() throws { controller = FetchController( definition: createFetchDefinition(), @@ -1284,12 +1322,14 @@ extension CollapsibleSectionsFetchedResultsControllerTestCase { } private extension CollapsibleSectionsFetchedResultsControllerTestCase { + @MainActor func performFetch(_ objectIDs: [String], file: StaticString = #file, line: UInt = #line) throws { let objects = objectIDs.compactMap { TestObject(id: $0) } try performFetch(objects, file: file, line: line) } + @MainActor func performFetch(_ objects: [TestObject], file: StaticString = #file, line: UInt = #line) throws { controller.performFetch() diff --git a/FetchRequests/Tests/Controllers/FetchedResultsControllerTestCase.swift b/FetchRequests/Tests/Controllers/FetchedResultsControllerTestCase.swift index be0940c..e8b0b13 100644 --- a/FetchRequests/Tests/Controllers/FetchedResultsControllerTestCase.swift +++ b/FetchRequests/Tests/Controllers/FetchedResultsControllerTestCase.swift @@ -9,7 +9,6 @@ import XCTest @testable import FetchRequests -@MainActor class FetchedResultsControllerTestCase: XCTestCase, FetchedResultsControllerTestHarness { // swiftlint:disable implicitly_unwrapped_optional test_case_accessibility @@ -70,6 +69,7 @@ class FetchedResultsControllerTestCase: XCTestCase, FetchedResultsControllerTest changeEvents = [] } + @MainActor func testBasicFetch() throws { controller = FetchedResultsController( definition: createFetchDefinition(), @@ -84,6 +84,7 @@ class FetchedResultsControllerTestCase: XCTestCase, FetchedResultsControllerTest XCTAssertEqual(controller.sections[0].fetchedIDs, objectIDs) } + @MainActor func testResort() throws { controller = FetchedResultsController( definition: createFetchDefinition(), @@ -100,6 +101,7 @@ class FetchedResultsControllerTestCase: XCTestCase, FetchedResultsControllerTest XCTAssertEqual(controller.sections[0].fetchedIDs, objectIDs.reversed()) } + @MainActor func testReset() throws { try testBasicFetch() controller.setDelegate(self) @@ -117,6 +119,7 @@ class FetchedResultsControllerTestCase: XCTestCase, FetchedResultsControllerTest XCTAssertEqual(controller.fetchedObjects, []) } + @MainActor func testClearDelegate() throws { controller = FetchedResultsController( definition: createFetchDefinition(), @@ -140,6 +143,7 @@ class FetchedResultsControllerTestCase: XCTestCase, FetchedResultsControllerTest XCTAssertEqual(controller.fetchedObjects.count, 3) } + @MainActor func testAccessByIndexPath() throws { try testBasicFetch() @@ -159,6 +163,7 @@ class FetchedResultsControllerTestCase: XCTestCase, FetchedResultsControllerTest XCTAssertEqual(lastIndexPath, fetchedLastIndexPath) } + @MainActor func testFetchAvoidsReplacingInstances() throws { controller = FetchedResultsController( definition: createFetchDefinition(), @@ -199,6 +204,7 @@ class FetchedResultsControllerTestCase: XCTestCase, FetchedResultsControllerTest XCTAssertEqual(controller.sections[0].tags, [3, 0, 2, 6, 7]) } + @MainActor func testBasicFetchWithSortDescriptors() throws { controller = FetchedResultsController( definition: createFetchDefinition(), @@ -225,6 +231,7 @@ class FetchedResultsControllerTestCase: XCTestCase, FetchedResultsControllerTest // MARK: - Sections extension FetchedResultsControllerTestCase { + @MainActor func testFetchingIntoSections() throws { controller = FetchedResultsController( definition: createFetchDefinition(), @@ -247,6 +254,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[2].objects, [objects[0]]) } + @MainActor func testFetchingIntoSectionsAndAccessingByIndexPath() throws { try testFetchingIntoSections() @@ -271,6 +279,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(lastIndexPath, fetchedLastIndexPath) } + @MainActor func testFetchingIntoSectionsAvoidsReplacingInstances() throws { controller = FetchedResultsController( definition: createFetchDefinition(), @@ -318,6 +327,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[1].tags, [6, 1, 2]) } + @MainActor func testFetchingIntoSectionsWithSortDescriptors() throws { controller = FetchedResultsController( definition: createFetchDefinition(), @@ -351,6 +361,7 @@ extension FetchedResultsControllerTestCase { // MARK: - Associated Values extension FetchedResultsControllerTestCase { + @MainActor func testFetchingAssociatedObjects() throws { controller = FetchedResultsController( definition: createFetchDefinition(associations: [\TestObject.tag]), @@ -401,6 +412,7 @@ extension FetchedResultsControllerTestCase { } #if canImport(UIKit) && !os(watchOS) + @MainActor func testAssociatedValuesAreDumpedOnMemoryPressure() throws { controller = FetchedResultsController( definition: createFetchDefinition(associations: [\TestObject.tag]), @@ -438,6 +450,7 @@ extension FetchedResultsControllerTestCase { } #endif + @MainActor func testAssociatedObjectsInvalidatedFromKVO() throws { controller = FetchedResultsController( definition: createFetchDefinition(associations: [\TestObject.tag]), @@ -475,6 +488,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(tagString2, "2") } + @MainActor func testMissingAssociatedObjectsInvalidatedFromNotifications() throws { controller = FetchedResultsController( definition: createFetchDefinition(associations: [\TestObject.tagID]), @@ -565,6 +579,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[2].fetchedIDs, ["c", "d"], file: file, line: line) } + @MainActor func testSectionChangeFromKVO() throws { try setupControllerForKVO() @@ -582,6 +597,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[2].fetchedIDs, ["d"]) } + @MainActor func testSectionCreationFromKVO() throws { try setupControllerForKVO() @@ -600,6 +616,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[3].fetchedIDs, ["z"]) } + @MainActor func testSectionDeletionFromKVO() throws { try setupControllerForKVO() @@ -616,6 +633,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[1].fetchedIDs, ["c", "b", "d"]) } + @MainActor func testOrderChangeFromKVO() throws { try setupControllerForKVO() @@ -630,6 +648,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[2].fetchedIDs, ["c", "d"]) } + @MainActor func testDeleteFromKVO() throws { controller = FetchedResultsController(definition: createFetchDefinition(), debounceInsertsAndReloads: false) controller.setDelegate(self) @@ -651,6 +670,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(changeEvents[0].object.id, "a") } + @MainActor func testAssociatedObjectDeleteFromKVO() throws { controller = FetchedResultsController( definition: createFetchDefinition(associations: [\TestObject.tagID]), @@ -699,6 +719,7 @@ extension FetchedResultsControllerTestCase { XCTAssertNil(associationRequest) } + @MainActor func testAssociatedObjectArrayDeleteFromKVO() throws { controller = FetchedResultsController( definition: createFetchDefinition(associations: [\TestObject.tagIDs]), @@ -747,6 +768,7 @@ extension FetchedResultsControllerTestCase { XCTAssertNil(associationRequest) } + @MainActor func testExpectNoReloadFromKVO() throws { // We need a custom controller so that sort descriptors is "empty" controller = FetchedResultsController( @@ -781,6 +803,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(controller.sections[2].fetchedIDs, ["c", "d"]) } + @MainActor func testExpectReloadFromKVO() throws { controller = FetchedResultsController(definition: createFetchDefinition(), debounceInsertsAndReloads: false) controller.setDelegate(self) @@ -798,6 +821,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(changeEvents[0].object.id, "a") } + @MainActor func testExpectReloadFromAssociatedObjectKVO() throws { controller = FetchedResultsController( definition: createFetchDefinition(associations: [\TestObject.tagID]), @@ -846,6 +870,7 @@ extension FetchedResultsControllerTestCase { XCTAssertNil(associationRequest) } + @MainActor func testExpectReloadFromAssociatedObjectArrayKVO() throws { controller = FetchedResultsController( definition: createFetchDefinition(associations: [\TestObject.tagIDs]), @@ -894,6 +919,7 @@ extension FetchedResultsControllerTestCase { XCTAssertNil(associationRequest) } + @MainActor func testExpectInsertFromBroadcastNotification() throws { controller = FetchedResultsController( definition: createFetchDefinition(), @@ -931,6 +957,7 @@ extension FetchedResultsControllerTestCase { XCTAssert(changeEvents.isEmpty) } + @MainActor func testExpectNoInsertFromBroadcastNotification() throws { controller = FetchedResultsController( definition: createFetchDefinition(), @@ -968,6 +995,7 @@ extension FetchedResultsControllerTestCase { XCTAssert(changeEvents.isEmpty) } + @MainActor func testExpectReloadFromDatabaseReset() throws { controller = FetchedResultsController( definition: createFetchDefinition(), @@ -1011,6 +1039,7 @@ extension FetchedResultsControllerTestCase { try performFetch(objects) } + @MainActor func testIndexPathNilForMissingObject() throws { try setupController() @@ -1018,6 +1047,7 @@ extension FetchedResultsControllerTestCase { XCTAssertNil(controller.indexPath(for: object)) } + @MainActor func testIndexPathAvailableForObject() throws { try setupController() @@ -1025,6 +1055,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(controller.indexPath(for: object), IndexPath(item: 1, section: 0)) } + @MainActor func testIndexPathNilForMissingObjectMatching() throws { try setupController() @@ -1032,6 +1063,7 @@ extension FetchedResultsControllerTestCase { XCTAssertNil(indexPath) } + @MainActor func testIndexPathAvailableForObjectMatching() throws { try setupController() @@ -1039,12 +1071,14 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(indexPath, IndexPath(item: 1, section: 0)) } + @MainActor func testIndexPathBeforeFirstSection() throws { try setupController() XCTAssertNil(controller.getIndexPath(before: IndexPath(item: 0, section: 0))) } + @MainActor func testIndexPathBeforeRegularSection() throws { try setupController() @@ -1052,6 +1086,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(indexPath, IndexPath(item: 2, section: 0)) } + @MainActor func testIndexPathBeforeItem() throws { try setupController() @@ -1059,12 +1094,14 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(indexPath, IndexPath(item: 0, section: 0)) } + @MainActor func testIndexPathAfterLastSection() throws { try setupController() XCTAssertNil(controller.getIndexPath(after: IndexPath(item: 0, section: 1))) } + @MainActor func testIndexPathAfterRegularSection() throws { try setupController() @@ -1072,6 +1109,7 @@ extension FetchedResultsControllerTestCase { XCTAssertEqual(indexPath, IndexPath(item: 0, section: 1)) } + @MainActor func testIndexPathAfterItem() throws { try setupController() diff --git a/FetchRequests/Tests/Models/FetchRequestAssociationTestCase.swift b/FetchRequests/Tests/Models/FetchRequestAssociationTestCase.swift index 74389c2..94fb27a 100644 --- a/FetchRequests/Tests/Models/FetchRequestAssociationTestCase.swift +++ b/FetchRequests/Tests/Models/FetchRequestAssociationTestCase.swift @@ -9,7 +9,6 @@ import XCTest @testable import FetchRequests -@MainActor class FetchRequestAssociationTestCase: XCTestCase { private typealias Association = FetchRequestAssociation @@ -35,6 +34,7 @@ class FetchRequestAssociationTestCase: XCTestCase { // MARK: - Basic Associations extension FetchRequestAssociationTestCase { + @MainActor func testBasicNonOptionalAssociation() { let expected: [String: Int] = ["a": 2] @@ -77,6 +77,7 @@ extension FetchRequestAssociationTestCase { observer.invalidate() } + @MainActor func testBasicOptionalAssociation() { let expected: [String: Int] = ["a": 2] @@ -123,6 +124,7 @@ extension FetchRequestAssociationTestCase { // MARK: - Observed Creation Associations extension FetchRequestAssociationTestCase { + @MainActor func testCreatableNonOptionalAssociation() { let expected: [String: TestObject] = ["a": objects[0]] @@ -186,6 +188,7 @@ extension FetchRequestAssociationTestCase { observer.invalidate() } + @MainActor func testCreatableOptionalAssociation() { let expected: [String: TestObject] = ["a": objects[0]] @@ -253,6 +256,7 @@ extension FetchRequestAssociationTestCase { // MARK: - Observed Creation by RawData Associations extension FetchRequestAssociationTestCase { + @MainActor func testCreatableNonOptionalAssociationByRawData() { let expected: [TestObject] = [TestObject(id: "0")] @@ -318,6 +322,7 @@ extension FetchRequestAssociationTestCase { observer.invalidate() } + @MainActor func testCreatableOptionalAssociationByRawData() { let expected: [TestObject] = [TestObject(id: "0")] @@ -386,6 +391,7 @@ extension FetchRequestAssociationTestCase { // MARK: - Observed Creation Array Associations extension FetchRequestAssociationTestCase { + @MainActor func testCreatableNonOptionalArrayAssociationByRawData() { let expected: [TestObject] = [TestObject(id: "0")] @@ -454,6 +460,7 @@ extension FetchRequestAssociationTestCase { observer.invalidate() } + @MainActor func testCreatableOptionalArrayAssociationByRawData() { let expected: [TestObject] = [TestObject(id: "0")] @@ -527,6 +534,7 @@ extension FetchRequestAssociationTestCase { // MARK: - FetchableEntityID Associations extension FetchRequestAssociationTestCase { + @MainActor func testNonOptionalFetchableEntityID() { let token = DataTestToken() let tokenGenerator: Association.TokenGenerator = { object in @@ -586,6 +594,7 @@ extension FetchRequestAssociationTestCase { observer.invalidate() } + @MainActor func testOptionalFetchableEntityID() { let token = DataTestToken() let tokenGenerator: Association.TokenGenerator = { object in @@ -647,6 +656,7 @@ extension FetchRequestAssociationTestCase { } extension FetchRequestAssociationTestCase { + @MainActor func testEntityFetchByID() { let id = TestFetchableEntityID(id: "a") let object = TestObject(id: "a") @@ -662,6 +672,7 @@ extension FetchRequestAssociationTestCase { wait(for: [expectation], timeout: 5) } + @MainActor func testFaultByEntityID() { let object = TestObject(id: "a") let expected = TestObject(id: "0") @@ -673,6 +684,7 @@ extension FetchRequestAssociationTestCase { XCTAssertEqual(nonOptionalResult, expected) } + @MainActor func testFaultByEntityIDArray() { let object = TestObject(id: "a") let expected = [TestObject(id: "0")] diff --git a/FetchRequests/Tests/SwiftUI/FetchableRequestTestCase.swift b/FetchRequests/Tests/SwiftUI/FetchableRequestTestCase.swift index bc6079f..b103233 100644 --- a/FetchRequests/Tests/SwiftUI/FetchableRequestTestCase.swift +++ b/FetchRequests/Tests/SwiftUI/FetchableRequestTestCase.swift @@ -10,7 +10,6 @@ import XCTest @testable import FetchRequests -@MainActor class FetchableRequestTestCase: XCTestCase { } @@ -23,6 +22,7 @@ extension FetchableRequestTestCase { return FetchDefinition(request: request) } + @MainActor func testCreation() { var instance = FetchableRequest( definition: createFetchDefinition(), @@ -40,6 +40,7 @@ extension FetchableRequestTestCase { XCTAssertTrue(instance.hasFetchedObjects) } + @MainActor func testSectionedCreation() { var instance = SectionedFetchableRequest( definition: createFetchDefinition(), From d14bf97e92409aee9ed0b0294846b1d41ebb7415 Mon Sep 17 00:00:00 2001 From: Adam Lickel Date: Wed, 6 Mar 2024 10:41:19 -0800 Subject: [PATCH 3/7] Bump macOS runs-on --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1c637e..fd9964a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - tvOS - watchOS - macOS - runs-on: macos-12 + runs-on: macos-14 steps: - name: Checkout uses: actions/checkout@v2 @@ -34,7 +34,7 @@ jobs: #uses: codecov/codecov-action@v2 run: bash <(curl -s https://codecov.io/bash); validate: - runs-on: macos-12 + runs-on: macos-14 needs: build steps: - name: Checkout From c9b8506f52025f3270400fef40958511dbc302cf Mon Sep 17 00:00:00 2001 From: Adam Lickel Date: Wed, 6 Mar 2024 11:07:33 -0800 Subject: [PATCH 4/7] Update Example project --- Example/iOS-Example.xcodeproj/project.pbxproj | 11 +++++++++-- .../xcschemes/iOS Example.xcscheme | 2 +- Example/iOS-Example/Observable.swift | 18 ++++++++++++------ .../xcschemes/FetchRequests-iOS.xcscheme | 2 +- .../xcschemes/FetchRequests-macOS.xcscheme | 2 +- .../xcschemes/FetchRequests-tvOS.xcscheme | 2 +- .../xcschemes/FetchRequests-watchOS.xcscheme | 2 +- 7 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Example/iOS-Example.xcodeproj/project.pbxproj b/Example/iOS-Example.xcodeproj/project.pbxproj index b1ed6b8..7dd27a3 100644 --- a/Example/iOS-Example.xcodeproj/project.pbxproj +++ b/Example/iOS-Example.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -199,8 +199,9 @@ 47ACD18722CBE39600B3F1FE /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1020; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1530; ORGANIZATIONNAME = "Speramus Inc."; TargetAttributes = { 47ACD18E22CBE39600B3F1FE = { @@ -345,6 +346,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -379,6 +381,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -400,6 +403,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_STRICT_CONCURRENCY = targeted; }; name = Debug; }; @@ -407,6 +411,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -441,6 +446,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -455,6 +461,7 @@ SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_STRICT_CONCURRENCY = targeted; VALIDATE_PRODUCT = YES; }; name = Release; diff --git a/Example/iOS-Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme b/Example/iOS-Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme index a63a917..6f6e495 100644 --- a/Example/iOS-Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme +++ b/Example/iOS-Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme @@ -1,6 +1,6 @@ { fileprivate var observers: Atomic<[UUID: Handler]> = Atomic(wrappedValue: [:]) var wrappedValue: Value { - @MainActor(unsafe) didSet { - assert(Thread.isMainThread) + unsafeHandler { + let change = Change(oldValue: oldValue, newValue: wrappedValue) + let observers = self.observers.wrappedValue - let change = Change(oldValue: oldValue, newValue: wrappedValue) - let observers = self.observers.wrappedValue - - observers.values.forEach { $0(change) } + observers.values.forEach { $0(change) } + } } } @@ -46,6 +45,13 @@ class Observable { } } +@MainActor(unsafe) +private func unsafeHandler(for handler: @MainActor () -> Void) { + assert(Thread.isMainThread) + // This is a dumb wrapper, but I can't otherwise have a "clean" compile + handler() +} + extension Observable where Value: Equatable { func observeChanges(handler: @escaping Handler) -> InvalidatableToken { observe { change in diff --git a/FetchRequests.xcodeproj/xcshareddata/xcschemes/FetchRequests-iOS.xcscheme b/FetchRequests.xcodeproj/xcshareddata/xcschemes/FetchRequests-iOS.xcscheme index 3ffc796..d7f5883 100644 --- a/FetchRequests.xcodeproj/xcshareddata/xcschemes/FetchRequests-iOS.xcscheme +++ b/FetchRequests.xcodeproj/xcshareddata/xcschemes/FetchRequests-iOS.xcscheme @@ -1,6 +1,6 @@ Date: Wed, 6 Mar 2024 11:16:00 -0800 Subject: [PATCH 5/7] Updated runners + brew install if needed --- .github/workflows/build.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd9964a..9c792f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,9 +22,9 @@ jobs: runs-on: macos-14 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Build - uses: mxcl/xcodebuild@v1 + uses: mxcl/xcodebuild@v2 with: platform: ${{ matrix.platform }} scheme: FetchRequests-${{ matrix.platform }} @@ -38,15 +38,19 @@ jobs: needs: build steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Swift Lint - run: swiftlint --strict + run: | + command -v swiftlint || brew install --quiet swiftlint + swiftlint --reporter github-actions-logging --strict - name: Swift Format - run: swiftformat --lint . + run: | + command -v swiftformat || brew install --quiet swiftformat + swiftformat --reporter github-actions-log --lint . - name: Pod Lint run: pod lib lint --quick --fail-fast --verbose --skip-tests - name: Example Project - uses: mxcl/xcodebuild@v1 + uses: mxcl/xcodebuild@v2 with: platform: iOS scheme: iOS Example From b651bad695c199a2c300839ead4a0268f8918f60 Mon Sep 17 00:00:00 2001 From: Adam Lickel Date: Wed, 6 Mar 2024 11:59:32 -0800 Subject: [PATCH 6/7] VisionOS tests --- .github/workflows/build.yml | 3 + FetchRequests.podspec | 3 + FetchRequests.xcodeproj/project.pbxproj | 300 +++++++++++++++++- .../xcschemes/FetchRequests-visionOS.xcscheme | 93 ++++++ FetchRequests/FetchRequests.h | 2 +- Package.swift | 3 +- 6 files changed, 401 insertions(+), 3 deletions(-) create mode 100644 FetchRequests.xcodeproj/xcshareddata/xcschemes/FetchRequests-visionOS.xcscheme diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c792f8..15d0074 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,7 @@ jobs: - tvOS - watchOS - macOS + #- visionOS runs-on: macos-14 steps: - name: Checkout @@ -28,6 +29,7 @@ jobs: with: platform: ${{ matrix.platform }} scheme: FetchRequests-${{ matrix.platform }} + xcode: 15.2 action: test code-coverage: true - name: Code Coverage @@ -54,6 +56,7 @@ jobs: with: platform: iOS scheme: iOS Example + xcode: 15.2 action: build warnings-as-errors: true working-directory: Example diff --git a/FetchRequests.podspec b/FetchRequests.podspec index dd8d4bd..129a4ed 100644 --- a/FetchRequests.podspec +++ b/FetchRequests.podspec @@ -11,11 +11,13 @@ Pod::Spec.new do |s| tvos_deployment_target = '14.0' watchos_deployment_target = '7.0' macos_deployment_target = '11' + visionos_deployment_target = '1' s.ios.deployment_target = ios_deployment_target s.tvos.deployment_target = tvos_deployment_target s.watchos.deployment_target = watchos_deployment_target s.macos.deployment_target = macos_deployment_target + s.visionos.deployment_target = visionos_deployment_target s.swift_version = '5.0' @@ -31,6 +33,7 @@ Pod::Spec.new do |s| test_spec.tvos.deployment_target = tvos_deployment_target test_spec.watchos.deployment_target = watchos_deployment_target test_spec.macos.deployment_target = macos_deployment_target + test_spec.visionos.deployment_target = visionos_deployment_target end end diff --git a/FetchRequests.xcodeproj/project.pbxproj b/FetchRequests.xcodeproj/project.pbxproj index f5e18b2..6459fbc 100644 --- a/FetchRequests.xcodeproj/project.pbxproj +++ b/FetchRequests.xcodeproj/project.pbxproj @@ -19,6 +19,41 @@ 2AB9763126A7A8DC0086AA77 /* OrderedSetCompat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AB9762F26A7A8DC0086AA77 /* OrderedSetCompat.swift */; }; 2AB9763226A7A8DC0086AA77 /* OrderedSetCompat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AB9762F26A7A8DC0086AA77 /* OrderedSetCompat.swift */; }; 2AB9763326A7A8DC0086AA77 /* OrderedSetCompat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AB9762F26A7A8DC0086AA77 /* OrderedSetCompat.swift */; }; + 2ABB23442B98FC770015F902 /* FetchRequests.h in Headers */ = {isa = PBXBuildFile; fileRef = 471C506F22C6D0DB007F73E9 /* FetchRequests.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2ABB23462B98FC770015F902 /* PaginatingFetchDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C508C22C6D18D007F73E9 /* PaginatingFetchDefinition.swift */; }; + 2ABB23472B98FC770015F902 /* ObservableToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C508922C6D18D007F73E9 /* ObservableToken.swift */; }; + 2ABB23482B98FC770015F902 /* IndexPath+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47A6ED7722CAA92F0034A854 /* IndexPath+Convenience.swift */; }; + 2ABB23492B98FC770015F902 /* BoxedJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47FB808E237CE816008F5438 /* BoxedJSON.swift */; }; + 2ABB234A2B98FC770015F902 /* AssociatedValueReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C508A22C6D18D007F73E9 /* AssociatedValueReference.swift */; }; + 2ABB234B2B98FC770015F902 /* CollapsibleSectionsFetchedResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C508E22C6D18D007F73E9 /* CollapsibleSectionsFetchedResultsController.swift */; }; + 2ABB234C2B98FC770015F902 /* FetchDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C509022C6D18D007F73E9 /* FetchDefinition.swift */; }; + 2ABB234D2B98FC770015F902 /* FetchedResultsControllerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C508722C6D18D007F73E9 /* FetchedResultsControllerProtocol.swift */; }; + 2ABB234E2B98FC770015F902 /* FetchRequestAssociation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C508D22C6D18D007F73E9 /* FetchRequestAssociation.swift */; }; + 2ABB234F2B98FC770015F902 /* FetchedResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C509122C6D18D007F73E9 /* FetchedResultsController.swift */; }; + 2ABB23502B98FC770015F902 /* OrderedSetCompat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AB9762F26A7A8DC0086AA77 /* OrderedSetCompat.swift */; }; + 2ABB23512B98FC770015F902 /* PausableFetchedResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C508F22C6D18D007F73E9 /* PausableFetchedResultsController.swift */; }; + 2ABB23522B98FC770015F902 /* CollectionType+SortDescriptors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C508B22C6D18D007F73E9 /* CollectionType+SortDescriptors.swift */; }; + 2ABB23532B98FC770015F902 /* FetchableRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6623972E267D034D009B696F /* FetchableRequest.swift */; }; + 2ABB23542B98FC770015F902 /* Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C508822C6D18D007F73E9 /* Logging.swift */; }; + 2ABB23552B98FC770015F902 /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47D33F062334163100E247E4 /* JSON.swift */; }; + 2ABB23562B98FC770015F902 /* FetchableEntityID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C509422C6D18D007F73E9 /* FetchableEntityID.swift */; }; + 2ABB23572B98FC770015F902 /* FetchableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C509322C6D18D007F73E9 /* FetchableObject.swift */; }; + 2ABB23592B98FC770015F902 /* Collections in Frameworks */ = {isa = PBXBuildFile; productRef = 2ABB23412B98FC770015F902 /* Collections */; }; + 2ABB23642B98FC7E0015F902 /* TestObject+FetchableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C50B622C6D337007F73E9 /* TestObject+FetchableObject.swift */; }; + 2ABB23652B98FC7E0015F902 /* TestObject+FetchRequests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47B31B502330671E00D6EB66 /* TestObject+FetchRequests.swift */; }; + 2ABB23662B98FC7E0015F902 /* PausableFetchedResultsControllerTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C50AE22C6D337007F73E9 /* PausableFetchedResultsControllerTestCase.swift */; }; + 2ABB23672B98FC7E0015F902 /* FetchedResultsControllerTestHarness.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C50B022C6D337007F73E9 /* FetchedResultsControllerTestHarness.swift */; }; + 2ABB23682B98FC7E0015F902 /* FetchableRequestTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A8096F826AA46C70035BFB4 /* FetchableRequestTestCase.swift */; }; + 2ABB23692B98FC7E0015F902 /* FetchRequestAssociationTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C50B422C6D337007F73E9 /* FetchRequestAssociationTestCase.swift */; }; + 2ABB236A2B98FC7E0015F902 /* JSONTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47C4ECE42335E969004F16D0 /* JSONTestCase.swift */; }; + 2ABB236B2B98FC7E0015F902 /* PaginatingFetchedResultsControllerTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C50AF22C6D337007F73E9 /* PaginatingFetchedResultsControllerTestCase.swift */; }; + 2ABB236C2B98FC7E0015F902 /* FetchableObjectProtocolTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C50B522C6D337007F73E9 /* FetchableObjectProtocolTestCase.swift */; }; + 2ABB236D2B98FC7E0015F902 /* FetchedResultsControllerTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C50B122C6D337007F73E9 /* FetchedResultsControllerTestCase.swift */; }; + 2ABB236E2B98FC7E0015F902 /* CollapsibleSectionsFetchedResultsControllerTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C50AC22C6D337007F73E9 /* CollapsibleSectionsFetchedResultsControllerTestCase.swift */; }; + 2ABB236F2B98FC7E0015F902 /* TestObject+Associations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C50B722C6D337007F73E9 /* TestObject+Associations.swift */; }; + 2ABB23702B98FC7E0015F902 /* LoggingTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47C4ECE823361358004F16D0 /* LoggingTestCase.swift */; }; + 2ABB23712B98FC7E0015F902 /* TestObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C50B222C6D337007F73E9 /* TestObject.swift */; }; + 2ABB23C52B9900720015F902 /* FetchRequests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2ABB235E2B98FC770015F902 /* FetchRequests.framework */; }; 471C507622C6D0DC007F73E9 /* FetchRequests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 471C506C22C6D0DB007F73E9 /* FetchRequests.framework */; }; 471C507D22C6D0DC007F73E9 /* FetchRequests.h in Headers */ = {isa = PBXBuildFile; fileRef = 471C506F22C6D0DB007F73E9 /* FetchRequests.h */; settings = {ATTRIBUTES = (Public, ); }; }; 471C509822C6D18D007F73E9 /* FetchedResultsControllerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471C508722C6D18D007F73E9 /* FetchedResultsControllerProtocol.swift */; }; @@ -150,6 +185,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 2ABB23C22B99005D0015F902 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 471C506322C6D0DB007F73E9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2ABB23402B98FC770015F902; + remoteInfo = "FetchRequests-visionOS"; + }; 471C507722C6D0DC007F73E9 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 471C506322C6D0DB007F73E9 /* Project object */; @@ -183,6 +225,9 @@ /* Begin PBXFileReference section */ 2A8096F826AA46C70035BFB4 /* FetchableRequestTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchableRequestTestCase.swift; sourceTree = ""; }; 2AB9762F26A7A8DC0086AA77 /* OrderedSetCompat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderedSetCompat.swift; sourceTree = ""; }; + 2ABB235E2B98FC770015F902 /* FetchRequests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FetchRequests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2ABB23782B98FC7E0015F902 /* FetchRequests-visionOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "FetchRequests-visionOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 2ABB23BD2B98FEB60015F902 /* FetchRequests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FetchRequests.h; sourceTree = ""; }; 4719618122C6DC6C000BBE6B /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = ""; }; 471C506C22C6D0DB007F73E9 /* FetchRequests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FetchRequests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 471C506F22C6D0DB007F73E9 /* FetchRequests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FetchRequests.h; sourceTree = ""; }; @@ -230,6 +275,22 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 2ABB23582B98FC770015F902 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2ABB23592B98FC770015F902 /* Collections in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2ABB23722B98FC7E0015F902 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2ABB23C52B9900720015F902 /* FetchRequests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 471C506922C6D0DB007F73E9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -312,6 +373,14 @@ name = Frameworks; sourceTree = ""; }; + 2ABB23BC2B98FEB60015F902 /* FetchRequests */ = { + isa = PBXGroup; + children = ( + 2ABB23BD2B98FEB60015F902 /* FetchRequests.h */, + ); + path = FetchRequests; + sourceTree = ""; + }; 471C506222C6D0DB007F73E9 = { isa = PBXGroup; children = ( @@ -320,6 +389,7 @@ 4719618122C6DC6C000BBE6B /* CHANGELOG.md */, 471C506E22C6D0DB007F73E9 /* FetchRequests */, 471C507922C6D0DC007F73E9 /* Tests */, + 2ABB23BC2B98FEB60015F902 /* FetchRequests */, 471C506D22C6D0DB007F73E9 /* Products */, 2A97F51526A8B44400027D90 /* Frameworks */, ); @@ -336,6 +406,8 @@ 47A6ED4622CA90A20034A854 /* FetchRequests.framework */, 47A6ED5D22CA90A40034A854 /* FetchRequests-macOSTests.xctest */, 6623974B267D03C0009B696F /* FetchRequests-watchOSTests.xctest */, + 2ABB235E2B98FC770015F902 /* FetchRequests.framework */, + 2ABB23782B98FC7E0015F902 /* FetchRequests-visionOSTests.xctest */, ); name = Products; sourceTree = ""; @@ -449,6 +521,14 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ + 2ABB23432B98FC770015F902 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 2ABB23442B98FC770015F902 /* FetchRequests.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 471C506722C6D0DB007F73E9 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -484,6 +564,45 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 2ABB23402B98FC770015F902 /* FetchRequests-visionOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2ABB235B2B98FC770015F902 /* Build configuration list for PBXNativeTarget "FetchRequests-visionOS" */; + buildPhases = ( + 2ABB23432B98FC770015F902 /* Headers */, + 2ABB23452B98FC770015F902 /* Sources */, + 2ABB23582B98FC770015F902 /* Frameworks */, + 2ABB235A2B98FC770015F902 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "FetchRequests-visionOS"; + packageProductDependencies = ( + 2ABB23412B98FC770015F902 /* Collections */, + ); + productName = FetchRequests; + productReference = 2ABB235E2B98FC770015F902 /* FetchRequests.framework */; + productType = "com.apple.product-type.framework"; + }; + 2ABB23602B98FC7E0015F902 /* FetchRequests-visionOSTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2ABB23752B98FC7E0015F902 /* Build configuration list for PBXNativeTarget "FetchRequests-visionOSTests" */; + buildPhases = ( + 2ABB23632B98FC7E0015F902 /* Sources */, + 2ABB23722B98FC7E0015F902 /* Frameworks */, + 2ABB23742B98FC7E0015F902 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2ABB23C32B99005D0015F902 /* PBXTargetDependency */, + ); + name = "FetchRequests-visionOSTests"; + productName = FetchRequestsTests; + productReference = 2ABB23782B98FC7E0015F902 /* FetchRequests-visionOSTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 471C506B22C6D0DB007F73E9 /* FetchRequests-iOS */ = { isa = PBXNativeTarget; buildConfigurationList = 471C508022C6D0DC007F73E9 /* Build configuration list for PBXNativeTarget "FetchRequests-iOS" */; @@ -646,9 +765,10 @@ 471C506322C6D0DB007F73E9 /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; CLASSPREFIX = ""; LastSwiftUpdateCheck = 1100; - LastUpgradeCheck = 1400; + LastUpgradeCheck = 1530; ORGANIZATIONNAME = "Speramus Inc."; TargetAttributes = { 471C506B22C6D0DB007F73E9 = { @@ -683,11 +803,27 @@ 47A6ED1722CA90640034A854 /* FetchRequests-tvOSTests */, 47A6ECCC22CA8FA80034A854 /* FetchRequests-watchOS */, 66239733267D03C0009B696F /* FetchRequests-watchOSTests */, + 2ABB23402B98FC770015F902 /* FetchRequests-visionOS */, + 2ABB23602B98FC7E0015F902 /* FetchRequests-visionOSTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 2ABB235A2B98FC770015F902 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2ABB23742B98FC7E0015F902 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 471C506A22C6D0DB007F73E9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -747,6 +883,52 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 2ABB23452B98FC770015F902 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2ABB23462B98FC770015F902 /* PaginatingFetchDefinition.swift in Sources */, + 2ABB23472B98FC770015F902 /* ObservableToken.swift in Sources */, + 2ABB23482B98FC770015F902 /* IndexPath+Convenience.swift in Sources */, + 2ABB23492B98FC770015F902 /* BoxedJSON.swift in Sources */, + 2ABB234A2B98FC770015F902 /* AssociatedValueReference.swift in Sources */, + 2ABB234B2B98FC770015F902 /* CollapsibleSectionsFetchedResultsController.swift in Sources */, + 2ABB234C2B98FC770015F902 /* FetchDefinition.swift in Sources */, + 2ABB234D2B98FC770015F902 /* FetchedResultsControllerProtocol.swift in Sources */, + 2ABB234E2B98FC770015F902 /* FetchRequestAssociation.swift in Sources */, + 2ABB234F2B98FC770015F902 /* FetchedResultsController.swift in Sources */, + 2ABB23502B98FC770015F902 /* OrderedSetCompat.swift in Sources */, + 2ABB23512B98FC770015F902 /* PausableFetchedResultsController.swift in Sources */, + 2ABB23522B98FC770015F902 /* CollectionType+SortDescriptors.swift in Sources */, + 2ABB23532B98FC770015F902 /* FetchableRequest.swift in Sources */, + 2ABB23542B98FC770015F902 /* Logging.swift in Sources */, + 2ABB23552B98FC770015F902 /* JSON.swift in Sources */, + 2ABB23562B98FC770015F902 /* FetchableEntityID.swift in Sources */, + 2ABB23572B98FC770015F902 /* FetchableObject.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2ABB23632B98FC7E0015F902 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2ABB23642B98FC7E0015F902 /* TestObject+FetchableObject.swift in Sources */, + 2ABB23652B98FC7E0015F902 /* TestObject+FetchRequests.swift in Sources */, + 2ABB23662B98FC7E0015F902 /* PausableFetchedResultsControllerTestCase.swift in Sources */, + 2ABB23672B98FC7E0015F902 /* FetchedResultsControllerTestHarness.swift in Sources */, + 2ABB23682B98FC7E0015F902 /* FetchableRequestTestCase.swift in Sources */, + 2ABB23692B98FC7E0015F902 /* FetchRequestAssociationTestCase.swift in Sources */, + 2ABB236A2B98FC7E0015F902 /* JSONTestCase.swift in Sources */, + 2ABB236B2B98FC7E0015F902 /* PaginatingFetchedResultsControllerTestCase.swift in Sources */, + 2ABB236C2B98FC7E0015F902 /* FetchableObjectProtocolTestCase.swift in Sources */, + 2ABB236D2B98FC7E0015F902 /* FetchedResultsControllerTestCase.swift in Sources */, + 2ABB236E2B98FC7E0015F902 /* CollapsibleSectionsFetchedResultsControllerTestCase.swift in Sources */, + 2ABB236F2B98FC7E0015F902 /* TestObject+Associations.swift in Sources */, + 2ABB23702B98FC7E0015F902 /* LoggingTestCase.swift in Sources */, + 2ABB23712B98FC7E0015F902 /* TestObject.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 471C506822C6D0DB007F73E9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -934,6 +1116,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 2ABB23C32B99005D0015F902 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2ABB23402B98FC770015F902 /* FetchRequests-visionOS */; + targetProxy = 2ABB23C22B99005D0015F902 /* PBXContainerItemProxy */; + }; 471C507822C6D0DC007F73E9 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 471C506B22C6D0DB007F73E9 /* FetchRequests-iOS */; @@ -957,6 +1144,72 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 2ABB235C2B98FC770015F902 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + SDKROOT = xros; + TARGETED_DEVICE_FAMILY = 7; + }; + name = Debug; + }; + 2ABB235D2B98FC770015F902 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + SDKROOT = xros; + TARGETED_DEVICE_FAMILY = 7; + }; + name = Release; + }; + 2ABB23762B98FC7E0015F902 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + INFOPLIST_FILE = FetchRequests/TestsInfo.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.crewapp.FetchRequestsTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = xros; + TARGETED_DEVICE_FAMILY = 7; + }; + name = Debug; + }; + 2ABB23772B98FC7E0015F902 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + INFOPLIST_FILE = FetchRequests/TestsInfo.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.crewapp.FetchRequestsTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = xros; + TARGETED_DEVICE_FAMILY = 7; + }; + name = Release; + }; 471C507E22C6D0DC007F73E9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -998,8 +1251,10 @@ DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; + ENABLE_MODULE_VERIFIER = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -1018,6 +1273,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; MACOSX_DEPLOYMENT_TARGET = 10.15; MARKETING_VERSION = 5.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -1035,6 +1291,7 @@ VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WATCHOS_DEPLOYMENT_TARGET = 6.0; + XROS_DEPLOYMENT_TARGET = 1.0; }; name = Debug; }; @@ -1079,8 +1336,10 @@ DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; + ENABLE_MODULE_VERIFIER = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -1093,6 +1352,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; MACOSX_DEPLOYMENT_TARGET = 10.15; MARKETING_VERSION = 5.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14"; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.crewapp.FetchRequests; @@ -1110,12 +1370,14 @@ VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WATCHOS_DEPLOYMENT_TARGET = 6.0; + XROS_DEPLOYMENT_TARGET = 1.0; }; name = Release; }; 471C508122C6D0DC007F73E9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = ""; DYLIB_INSTALL_NAME_BASE = "@rpath"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( @@ -1130,6 +1392,7 @@ 471C508222C6D0DC007F73E9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = ""; DYLIB_INSTALL_NAME_BASE = "@rpath"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( @@ -1176,6 +1439,7 @@ 47A6ECE222CA8FA80034A854 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = ""; DYLIB_INSTALL_NAME_BASE = "@rpath"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( @@ -1191,6 +1455,7 @@ 47A6ECE322CA8FA80034A854 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = ""; DYLIB_INSTALL_NAME_BASE = "@rpath"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( @@ -1206,6 +1471,7 @@ 47A6ED1322CA905A0034A854 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = ""; DYLIB_INSTALL_NAME_BASE = "@rpath"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( @@ -1221,6 +1487,7 @@ 47A6ED1422CA905A0034A854 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = ""; DYLIB_INSTALL_NAME_BASE = "@rpath"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( @@ -1368,6 +1635,24 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 2ABB235B2B98FC770015F902 /* Build configuration list for PBXNativeTarget "FetchRequests-visionOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2ABB235C2B98FC770015F902 /* Debug */, + 2ABB235D2B98FC770015F902 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2ABB23752B98FC7E0015F902 /* Build configuration list for PBXNativeTarget "FetchRequests-visionOSTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2ABB23762B98FC7E0015F902 /* Debug */, + 2ABB23772B98FC7E0015F902 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 471C506622C6D0DB007F73E9 /* Build configuration list for PBXProject "FetchRequests" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -1460,6 +1745,14 @@ minimumVersion = 1.0.0; }; }; + 2ABB23422B98FC770015F902 /* XCRemoteSwiftPackageReference "swift-collections" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/apple/swift-collections.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 1.0.0; + }; + }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -1483,6 +1776,11 @@ package = 2A97F51226A8B43100027D90 /* XCRemoteSwiftPackageReference "swift-collections" */; productName = Collections; }; + 2ABB23412B98FC770015F902 /* Collections */ = { + isa = XCSwiftPackageProductDependency; + package = 2ABB23422B98FC770015F902 /* XCRemoteSwiftPackageReference "swift-collections" */; + productName = Collections; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 471C506322C6D0DB007F73E9 /* Project object */; diff --git a/FetchRequests.xcodeproj/xcshareddata/xcschemes/FetchRequests-visionOS.xcscheme b/FetchRequests.xcodeproj/xcshareddata/xcschemes/FetchRequests-visionOS.xcscheme new file mode 100644 index 0000000..21b3ea9 --- /dev/null +++ b/FetchRequests.xcodeproj/xcshareddata/xcschemes/FetchRequests-visionOS.xcscheme @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FetchRequests/FetchRequests.h b/FetchRequests/FetchRequests.h index 2170529..8534dfd 100644 --- a/FetchRequests/FetchRequests.h +++ b/FetchRequests/FetchRequests.h @@ -6,7 +6,7 @@ // Copyright © 2019 Speramus Inc. All rights reserved. // -@import Foundation; +#import //! Project version number for FetchRequests. FOUNDATION_EXPORT double FetchRequestsVersionNumber; diff --git a/Package.swift b/Package.swift index 69caa9e..fc64833 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.7 +// swift-tools-version:5.9 import PackageDescription @@ -10,6 +10,7 @@ let package = Package( .tvOS(.v14), .watchOS(.v7), .macOS(.v11), + .visionOS(.v1), ], products: [ .library( From bde93ca197fc87f65ed0b64acc50b42a530b0553 Mon Sep 17 00:00:00 2001 From: Adam Lickel Date: Wed, 6 Mar 2024 10:22:10 -0800 Subject: [PATCH 7/7] Version bump to v6.0.3 --- CHANGELOG.md | 5 +++++ FetchRequests.podspec | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd0fa3b..6df0c29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. `FetchRequests` adheres to [Semantic Versioning](https://semver.org/). +## [6.0.3](https://github.com/square/FetchRequests/releases/tag/6.0.3) +Released on 2024-03-06 + +* Cleanup warnings in Xcode 15.3 + ## [6.0.2](https://github.com/square/FetchRequests/releases/tag/6.0.2) Released on 2023-09-21 diff --git a/FetchRequests.podspec b/FetchRequests.podspec index 129a4ed..6b73a96 100644 --- a/FetchRequests.podspec +++ b/FetchRequests.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FetchRequests' - s.version = '6.0.2' + s.version = '6.0.3' s.license = 'MIT' s.summary = 'NSFetchedResultsController inspired eventing' s.homepage = 'https://github.com/square/FetchRequests'