From 3d8b0915db590098e63601e2d774d97fd7fdba84 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 9 Nov 2025 11:49:20 -0800 Subject: [PATCH] Add category method to post notification on main thread. --- .../Shared/NotificationCenter+RSCore.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Modules/RSCore/Sources/RSCore/Shared/NotificationCenter+RSCore.swift diff --git a/Modules/RSCore/Sources/RSCore/Shared/NotificationCenter+RSCore.swift b/Modules/RSCore/Sources/RSCore/Shared/NotificationCenter+RSCore.swift new file mode 100644 index 000000000..48d68feed --- /dev/null +++ b/Modules/RSCore/Sources/RSCore/Shared/NotificationCenter+RSCore.swift @@ -0,0 +1,17 @@ +// +// NotificationCenter+RSCore.swift +// RSCore +// +// Created by Brent Simmons on 11/9/25. +// + +import Foundation + +public extension NotificationCenter { + + func postOnMainThread(name: Notification.Name, object: Any?, userInfo: [AnyHashable : Any]? = nil) { + Task { @MainActor in + NotificationCenter.default.post(name: name, object: object, userInfo: userInfo) + } + } +}