From ba1b48cfccb0395342de906152940ec65513f07a Mon Sep 17 00:00:00 2001 From: Sergei Pimenov Date: Mon, 2 Mar 2026 23:09:57 -0800 Subject: [PATCH] Fix SwiftUI Previews --- Source/ASInternalHelpers.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/ASInternalHelpers.mm b/Source/ASInternalHelpers.mm index aacc5e9c4..182d25e06 100644 --- a/Source/ASInternalHelpers.mm +++ b/Source/ASInternalHelpers.mm @@ -65,7 +65,7 @@ void ASInitializeFrameworkMainThreadOnConstructor(void) { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - ASDisplayNodeCAssertMainThread(); + ASDisplayNodeCAssert([NSThread isMainThread], @"This method must be called on the main/preview-host thread"); ASNotifyInitialized(); #if AS_SIGNPOST_ENABLE _ASInitializeSignpostObservers(); @@ -77,7 +77,7 @@ void ASInitializeFrameworkMainThreadOnDestructor(void) { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - ASDisplayNodeCAssertMainThread(); + ASDisplayNodeCAssert([NSThread isMainThread], @"This method must be called on the main/preview-host thread"); // Ensure these values are cached on the main thread before needed in the background. if (ASActivateExperimentalFeature(ASExperimentalLayerDefaults)) { // Nop. We will gather default values on-demand in ASDefaultAllowsGroupOpacity and ASDefaultAllowsEdgeAntialiasing