Skip to content

Commit 8ffedf5

Browse files
authored
Cleanup build time warnings with Xcode 15 (#48)
1 parent 2f838d0 commit 8ffedf5

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

FetchRequests/Sources/Controller/FetchedResultsController.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,18 @@ public struct FetchedResultsSection<FetchedObject: FetchableObject>: Equatable,
172172
// MARK: - FetchedResultsController
173173

174174
func performOnMainThread(async: Bool = true, handler: @escaping @MainActor () -> Void) {
175+
@MainActor(unsafe)
176+
func unsafeHandler() {
177+
handler()
178+
}
179+
175180
if !Thread.isMainThread {
176181
if async {
177182
DispatchQueue.main.async(execute: handler)
178183
} else {
179-
DispatchQueue.main.sync(execute: handler)
184+
DispatchQueue.main.sync(execute: unsafeHandler)
180185
}
181186
} else {
182-
@MainActor(unsafe)
183-
func unsafeHandler() {
184-
handler()
185-
}
186187
unsafeHandler()
187188
}
188189
}
@@ -1361,7 +1362,7 @@ private class Weak<Element: AnyObject>: NSObject {
13611362
}
13621363

13631364
private struct AssociatedKeys {
1364-
static var context = "context"
1365+
static var context = 0
13651366
}
13661367

13671368
private extension FetchableObjectProtocol where Self: NSObject {

FetchRequests/Tests/TestObject.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010
import FetchRequests
1111

12-
final class TestObject: NSObject {
12+
final class TestObject: NSObject, @unchecked Sendable {
1313
typealias RawData = JSON
1414

1515
@objc dynamic var id: String

0 commit comments

Comments
 (0)