Skip to content

Commit 4c001f3

Browse files
authored
Merge pull request #36 from roanutil/feature/sendable
Add Sendable Conformances (Depends on #35)
2 parents f9b1905 + f479476 commit 4c001f3

25 files changed

Lines changed: 171 additions & 121 deletions

.swiftformat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--extensionacl on-declarations
22
--redundanttype explicit
3-
--swiftversion 5.8
3+
--swiftversion 5.10
44
--maxwidth 120
55
--header "{file}\nCoreDataRepository\n\nThis source code is licensed under the MIT License (MIT) found in the\nLICENSE file in the root directory of this source tree."
66
--allman false

CoreDataRepository.xctestplan

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"configurations" : [
3+
{
4+
"id" : "3473C2E6-8765-4CE5-8DCC-FAF7D66E9FD2",
5+
"name" : "Test Scheme Action",
6+
"options" : {
7+
8+
}
9+
}
10+
],
11+
"defaultOptions" : {
12+
"commandLineArgumentEntries" : [
13+
{
14+
"argument" : "-com.apple.CoreData.ConcurrencyDebug 1"
15+
},
16+
{
17+
"argument" : "-com.apple.CoreData.SQLDebug 4",
18+
"enabled" : false
19+
},
20+
{
21+
"argument" : "-com.apple.CoreData.SQLDebug 4",
22+
"enabled" : false
23+
}
24+
]
25+
},
26+
"testTargets" : [
27+
{
28+
"target" : {
29+
"containerPath" : "container:",
30+
"identifier" : "CoreDataRepositoryTests",
31+
"name" : "CoreDataRepositoryTests"
32+
}
33+
}
34+
],
35+
"version" : 1
36+
}

Package.swift

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,25 @@ let package = Package(
4545
)
4646

4747
extension [SupportedPlatform] {
48-
static let shared: Self = {
49-
if ProcessInfo.benchmarkingEnabled {
50-
[
51-
.iOS(.v15),
52-
.macOS(.v12),
53-
.tvOS(.v15),
54-
.watchOS(.v8),
55-
.macCatalyst(.v15),
56-
.visionOS(.v1),
57-
]
58-
} else {
59-
[
60-
.iOS(.v15),
61-
.macOS(.v13),
62-
.tvOS(.v15),
63-
.watchOS(.v8),
64-
.macCatalyst(.v15),
65-
.visionOS(.v1),
66-
]
67-
}
68-
}()
48+
static let shared: Self = if ProcessInfo.benchmarkingEnabled {
49+
[
50+
.iOS(.v15),
51+
.macOS(.v12),
52+
.tvOS(.v15),
53+
.watchOS(.v8),
54+
.macCatalyst(.v15),
55+
.visionOS(.v1),
56+
]
57+
} else {
58+
[
59+
.iOS(.v15),
60+
.macOS(.v13),
61+
.tvOS(.v15),
62+
.watchOS(.v8),
63+
.macCatalyst(.v15),
64+
.visionOS(.v1),
65+
]
66+
}
6967
}
7068

7169
extension [SwiftSetting] {
@@ -76,7 +74,7 @@ extension [SwiftSetting] {
7674
.enableUpcomingFeature("DisableOutwardActorInference"),
7775
.enableUpcomingFeature("ForwardTrailingClosures"),
7876
.enableUpcomingFeature("ImportObjcForwardDeclarations"),
79-
.enableExperimentalFeature("StrictConcurrency"),
77+
.enableUpcomingFeature("StrictConcurrency"),
8078
]
8179
}
8280

Sources/CoreDataRepository/CoreDataError.swift

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -59,65 +59,65 @@ public enum CoreDataError: Error, Hashable, Sendable {
5959
public var localizedDescription: String {
6060
switch self {
6161
case .failedToGetObjectIdFromUrl:
62-
return NSLocalizedString(
62+
NSLocalizedString(
6363
"No NSManagedObjectID found that correlates to the provided URL.",
6464
bundle: .module,
6565
comment: "Error for when an ObjectID can't be found for the provided URL."
6666
)
6767
case .propertyDoesNotMatchEntity:
68-
return NSLocalizedString(
68+
NSLocalizedString(
6969
"There is a mismatch between a provided NSPropertyDescrption's entity and a NSEntityDescription. "
7070
+ "When a property description is provided, it must match any related entity descriptions.",
7171
bundle: .module,
7272
comment: "Error for when the developer does not provide a valid pair of NSAttributeDescription "
7373
+ "and NSPropertyDescription (or any of their child types)."
7474
)
7575
case .fetchedObjectFailedToCastToExpectedType:
76-
return NSLocalizedString(
76+
NSLocalizedString(
7777
"The object corresponding to the provided NSManagedObjectID is an incorrect Entity or "
7878
+ "NSManagedObject subtype. It failed to cast to the requested type.",
7979
bundle: .module,
8080
comment: "Error for when an object is found for a given ObjectID but it is not the expected type."
8181
)
8282
case .fetchedObjectIsFlaggedAsDeleted:
83-
return NSLocalizedString(
83+
NSLocalizedString(
8484
"The object corresponding to the provided NSManagedObjectID is deleted and cannot be fetched.",
8585
bundle: .module,
8686
comment: "Error for when an object is fetched but is flagged as deleted and is no longer usable."
8787
)
8888
case let .cocoa(error):
89-
return error.localizedDescription
89+
error.localizedDescription
9090
case let .unknown(error):
91-
return error.localizedDescription
91+
error.localizedDescription
9292
case .noEntityNameFound:
93-
return NSLocalizedString(
93+
NSLocalizedString(
9494
"The managed object entity description does not have a name.",
9595
bundle: .module,
9696
comment: "Error for when the NSEntityDescription does not have a name."
9797
)
9898
case .atLeastOneAttributeDescRequired:
99-
return NSLocalizedString(
99+
NSLocalizedString(
100100
"The managed object entity has no attribute description. An attribute description is required for "
101101
+ "aggregate operations.",
102102
bundle: .module,
103103
comment: "Error for when the NSEntityDescription has no NSAttributeDescription but one is required."
104104
)
105105
case .noUrlOnItemToMapToObjectId:
106-
return NSLocalizedString(
106+
NSLocalizedString(
107107
"No object ID URL found on the model for an operation against an existing managed object.",
108108
bundle: .module,
109109
comment: "Error for performing an operation against an existing NSManagedObject but the "
110110
+ "ManagedIdUrlReferencable instance has no managedIdUrl for looking up the NSManagedOjbectID."
111111
)
112112
case .noObjectIdOnItem:
113-
return NSLocalizedString(
113+
NSLocalizedString(
114114
"No object ID found on the model for an operation against an existing managed object.",
115115
bundle: .module,
116116
comment: "Error for performing an operation against an existing NSManagedObject but the "
117117
+ "ManagedIdReferencable instance has no managedId."
118118
)
119119
case .noMatchFoundWhenReadingItem:
120-
return NSLocalizedString(
120+
NSLocalizedString(
121121
"No match found when attempting to read an instance from CoreData.",
122122
bundle: .module,
123123
comment: "Error for reading an instance from CoreData but no instance was found."
@@ -133,27 +133,27 @@ extension CoreDataError: CustomNSError {
133133
public var errorCode: Int {
134134
switch self {
135135
case .failedToGetObjectIdFromUrl:
136-
return 1
136+
1
137137
case .propertyDoesNotMatchEntity:
138-
return 2
138+
2
139139
case .fetchedObjectFailedToCastToExpectedType:
140-
return 3
140+
3
141141
case .fetchedObjectIsFlaggedAsDeleted:
142-
return 4
142+
4
143143
case .cocoa:
144-
return 5
144+
5
145145
case .unknown:
146-
return 6
146+
6
147147
case .noEntityNameFound:
148-
return 7
148+
7
149149
case .atLeastOneAttributeDescRequired:
150-
return 8
150+
8
151151
case .noUrlOnItemToMapToObjectId:
152-
return 9
152+
9
153153
case .noObjectIdOnItem:
154-
return 10
154+
10
155155
case .noMatchFoundWhenReadingItem:
156-
return 11
156+
11
157157
}
158158
}
159159

@@ -163,27 +163,27 @@ extension CoreDataError: CustomNSError {
163163
public var errorUserInfo: [String: Any] {
164164
switch self {
165165
case let .failedToGetObjectIdFromUrl(url):
166-
return [Self.urlUserInfoKey: url]
166+
[Self.urlUserInfoKey: url]
167167
case .propertyDoesNotMatchEntity:
168-
return [:]
168+
[:]
169169
case .fetchedObjectFailedToCastToExpectedType:
170-
return [:]
170+
[:]
171171
case .fetchedObjectIsFlaggedAsDeleted:
172-
return [:]
172+
[:]
173173
case let .cocoa(error):
174-
return error.userInfo
174+
error.userInfo
175175
case let .unknown(error):
176-
return error.userInfo
176+
error.userInfo
177177
case .noEntityNameFound:
178-
return [:]
178+
[:]
179179
case .atLeastOneAttributeDescRequired:
180-
return [:]
180+
[:]
181181
case .noUrlOnItemToMapToObjectId:
182-
return [:]
182+
[:]
183183
case .noObjectIdOnItem:
184-
return [:]
184+
[:]
185185
case .noMatchFoundWhenReadingItem:
186-
return [:]
186+
[:]
187187
}
188188
}
189189
}

0 commit comments

Comments
 (0)