Skip to content

Commit

Permalink
Header docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Aug 20, 2024
1 parent 2c912a8 commit 3125775
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/MainOffender/NotificationCenter+Unsafe.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import Foundation

extension NotificationCenter {
/// Receieve notifications with a block that unsafely removes its `@Sendable` requirements.
public func addUnsafeObserver(forName name: NSNotification.Name?, object obj: Any?, queue: OperationQueue?, using unsafeBlock: @escaping (Notification) -> Void) -> NSObjectProtocol {
let block = unsafeBitCast(unsafeBlock, to: (@Sendable (Notification) -> Void).self)

return addObserver(forName: name, object: obj, queue: queue, using: block)
}

/// Receieve notifications that are known to always be delivered on the `MainActor`.
public func addMainActorObserver(
forName name: NSNotification.Name?,
object obj: Any?,
Expand Down

0 comments on commit 3125775

Please sign in to comment.