@@ -4,6 +4,10 @@ import XCTest
44
55@available ( iOS 16 , macOS 13 , tvOS 16 , watchOS 9 , * )
66final class StorePerceptionTests : BaseTCATestCase {
7+ override func setUpWithError( ) throws {
8+ try checkAvailability ( )
9+ }
10+
711 @MainActor
812 func testPerceptionCheck_SkipWhenOutsideView( ) {
913 let store = Store ( initialState: Feature . State ( ) ) {
@@ -43,8 +47,10 @@ final class StorePerceptionTests: BaseTCATestCase {
4347 render ( FeatureView ( ) )
4448 } issueMatcher: {
4549 $0. compactDescription == """
46- Perceptible state was accessed but is not being tracked. Track changes to state by \
47- wrapping your view in a 'WithPerceptionTracking' view.
50+ failed - Perceptible state was accessed but is not being tracked. Track changes to state by \
51+ wrapping your view in a 'WithPerceptionTracking' view. This must also be done for any \
52+ escaping, trailing closures, such as 'GeometryReader', `LazyVStack` (and all lazy \
53+ views), navigation APIs ('sheet', 'popover', 'fullScreenCover', etc.), and others.
4854 """
4955 }
5056 }
@@ -87,3 +93,10 @@ private struct Feature {
8793 }
8894 }
8995}
96+
97+ // NB: Workaround to XCTest ignoring `@available(...)` attributes.
98+ private func checkAvailability( ) throws {
99+ guard #available( iOS 16 , macOS 13 , tvOS 16 , watchOS 9 , * ) else {
100+ throw XCTSkip ( " Requires iOS 16, macOS 13, tvOS 16, or watchOS 9 " )
101+ }
102+ }
0 commit comments