@@ -46,6 +46,7 @@ enum TestUtils {
4646@discardableResult
4747func introspection< Entity: AnyObject & Sendable > (
4848 of type: Entity . Type ,
49+ timeout: TimeInterval = 3 ,
4950 @ViewBuilder view: (
5051 _ spy1: @escaping ( Entity ) -> Void
5152 ) -> some View
@@ -61,7 +62,11 @@ func introspection<Entity: AnyObject & Sendable>(
6162
6263 TestUtils . present ( view: view)
6364
64- while entity1 == nil {
65+ let startInstant = Date ( )
66+ while
67+ Date ( ) . timeIntervalSince ( startInstant) < timeout,
68+ entity1 == nil
69+ {
6570 await Task . yield ( )
6671 }
6772
@@ -73,6 +78,7 @@ func introspection<Entity: AnyObject & Sendable>(
7378@discardableResult
7479func introspection< Entity: AnyObject & Sendable > (
7580 of type: Entity . Type ,
81+ timeout: TimeInterval = 3 ,
7682 @ViewBuilder view: (
7783 _ spy1: @escaping ( Entity ) -> Void ,
7884 _ spy2: @escaping ( Entity ) -> Void
@@ -95,7 +101,9 @@ func introspection<Entity: AnyObject & Sendable>(
95101
96102 TestUtils . present ( view: view)
97103
104+ let startInstant = Date ( )
98105 while
106+ Date ( ) . timeIntervalSince ( startInstant) < timeout,
99107 entity1 == nil ||
100108 entity2 == nil
101109 {
@@ -114,6 +122,7 @@ func introspection<Entity: AnyObject & Sendable>(
114122@discardableResult
115123func introspection< Entity: AnyObject & Sendable > (
116124 of type: Entity . Type ,
125+ timeout: TimeInterval = 3 ,
117126 @ViewBuilder view: (
118127 _ spy1: @escaping ( Entity ) -> Void ,
119128 _ spy2: @escaping ( Entity ) -> Void ,
@@ -143,7 +152,9 @@ func introspection<Entity: AnyObject & Sendable>(
143152
144153 TestUtils . present ( view: view)
145154
155+ let startInstant = Date ( )
146156 while
157+ Date ( ) . timeIntervalSince ( startInstant) < timeout,
147158 entity1 == nil ||
148159 entity2 == nil ||
149160 entity3 == nil
@@ -165,6 +176,7 @@ func introspection<Entity: AnyObject & Sendable>(
165176@discardableResult
166177func introspection< Entity: AnyObject & Sendable > (
167178 of type: Entity . Type ,
179+ timeout: TimeInterval = 3 ,
168180 @ViewBuilder view: (
169181 _ spy1: @escaping ( Entity ) -> Void ,
170182 _ spy2: @escaping ( Entity ) -> Void ,
@@ -201,7 +213,9 @@ func introspection<Entity: AnyObject & Sendable>(
201213
202214 TestUtils . present ( view: view)
203215
216+ let startInstant = Date ( )
204217 while
218+ Date ( ) . timeIntervalSince ( startInstant) < timeout,
205219 entity1 == nil ||
206220 entity2 == nil ||
207221 entity3 == nil ||
0 commit comments