21
21
22
22
import AsyncDisplayKit
23
23
24
- fileprivate let queue = DispatchQueue . global ( )
25
-
26
24
public enum DisplayNodeAction {
27
25
case didLoad
28
26
}
@@ -42,10 +40,10 @@ open class NamedDisplayNodeBase: ASDisplayNode {
42
40
open override func didLoad( ) {
43
41
super. didLoad ( )
44
42
#if DEBUG
45
- queue . async { [ weak self] in
43
+ Task . detached { [ weak self] in
46
44
guard let self = self else { return }
47
45
let typeName = _typeName ( type ( of: self ) )
48
- DispatchQueue . main . async {
46
+ Task { @ MainActor in
49
47
guard self . accessibilityIdentifier == nil else { return }
50
48
self . accessibilityIdentifier = typeName
51
49
}
@@ -71,7 +69,6 @@ open class NamedDisplayNodeBase: ASDisplayNode {
71
69
return self
72
70
}
73
71
74
- @preconcurrency
75
72
@MainActor
76
73
private func propagate( action: DisplayNodeAction ) {
77
74
for handler in __actionHandlers {
@@ -96,10 +93,10 @@ open class NamedDisplayControlNodeBase: ASControlNode {
96
93
open override func didLoad( ) {
97
94
super. didLoad ( )
98
95
#if DEBUG
99
- queue . async { [ weak self] in
96
+ Task . detached { [ weak self] in
100
97
guard let self = self else { return }
101
98
let typeName = _typeName ( type ( of: self ) )
102
- DispatchQueue . main . async {
99
+ Task { @ MainActor in
103
100
guard self . accessibilityIdentifier == nil else { return }
104
101
self . accessibilityIdentifier = typeName
105
102
}
@@ -113,7 +110,7 @@ open class NamedDisplayControlNodeBase: ASControlNode {
113
110
- Warning: Non-atomic
114
111
*/
115
112
@discardableResult
116
- public func addNodeActionHandler( _ handler: @escaping ( Self , DisplayNodeAction ) -> Void ) -> Self {
113
+ public func addNodeActionHandler( _ handler: @escaping @ MainActor ( Self , DisplayNodeAction ) -> Void ) -> Self {
117
114
__actionHandlers. append { node, action in
118
115
guard let node = node as? Self else {
119
116
assertionFailure ( )
0 commit comments