Skip to content

Commit 56a734f

Browse files
committed
WIP
1 parent ad2fd38 commit 56a734f

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

Sources/ViewTypes/WebView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extension iOSViewVersion<MapType, WKWebView> {
4040
public static let v17 = Self.unavailable()
4141
@available(*, unavailable, message: "WebView isn't available on iOS 18")
4242
public static let v18 = Self.unavailable()
43+
4344
public static let v26 = Self(for: .v26)
4445
}
4546

@@ -56,6 +57,7 @@ extension tvOSViewVersion<MapType, WKWebView> {
5657
public static let v17 = Self.unavailable()
5758
@available(*, unavailable, message: "WebView isn't available on tvOS 18")
5859
public static let v18 = Self.unavailable()
60+
5961
public static let v26 = Self(for: .v26)
6062
}
6163

@@ -72,6 +74,7 @@ extension macOSViewVersion<MapType, WKWebView> {
7274
public static let v14 = Self.unavailable()
7375
@available(*, unavailable, message: "WebView isn't available on macOS 15")
7476
public static let v15 = Self.unavailable()
77+
7578
public static let v26 = Self(for: .v26)
7679
}
7780

@@ -80,6 +83,7 @@ extension visionOSViewVersion<MapType, WKWebView> {
8083
public static let v1 = Self.unavailable()
8184
@available(*, unavailable, message: "WebView isn't available on visionOS 2")
8285
public static let v2 = Self.unavailable()
86+
8387
public static let v26 = Self(for: .v26)
8488
}
8589
#endif

Tests/Tests.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
D503B2AC2A49BFE300027F5F /* VideoPlayerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D503B2AB2A49BFE300027F5F /* VideoPlayerTests.swift */; };
1111
D50FFE8E2A17E2A400C32641 /* ScrollViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D50FFE8D2A17E2A400C32641 /* ScrollViewTests.swift */; };
1212
D534D4DC2A4A596200218BFB /* WindowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D534D4DB2A4A596200218BFB /* WindowTests.swift */; };
13+
D55BAD142DFF2B050038443E /* WebViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55BAD132DFF2B050038443E /* WebViewTests.swift */; };
1314
D55F448D2A1FF209003381E4 /* ListTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55F448C2A1FF209003381E4 /* ListTests.swift */; };
1415
D57506782A27BBBD00A628E4 /* PickerWithSegmentedStyleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D57506772A27BBBD00A628E4 /* PickerWithSegmentedStyleTests.swift */; };
1516
D575067A2A27BF6C00A628E4 /* PickerWithMenuStyleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D57506792A27BF6C00A628E4 /* PickerWithMenuStyleTests.swift */; };
@@ -101,6 +102,7 @@
101102
D50FFE8D2A17E2A400C32641 /* ScrollViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollViewTests.swift; sourceTree = "<group>"; };
102103
D534D4DB2A4A596200218BFB /* WindowTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowTests.swift; sourceTree = "<group>"; };
103104
D549D9732A66D876005D4FB5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
105+
D55BAD132DFF2B050038443E /* WebViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewTests.swift; sourceTree = "<group>"; };
104106
D55F448C2A1FF209003381E4 /* ListTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTests.swift; sourceTree = "<group>"; };
105107
D57506772A27BBBD00A628E4 /* PickerWithSegmentedStyleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PickerWithSegmentedStyleTests.swift; sourceTree = "<group>"; };
106108
D57506792A27BF6C00A628E4 /* PickerWithMenuStyleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PickerWithMenuStyleTests.swift; sourceTree = "<group>"; };
@@ -317,6 +319,7 @@
317319
D503B2AB2A49BFE300027F5F /* VideoPlayerTests.swift */,
318320
D58119C52A227E930081F853 /* ViewTests.swift */,
319321
D5F26E032A56E74B001209E6 /* ViewControllerTests.swift */,
322+
D55BAD132DFF2B050038443E /* WebViewTests.swift */,
320323
D534D4DB2A4A596200218BFB /* WindowTests.swift */,
321324
);
322325
path = ViewTypes;
@@ -606,6 +609,7 @@
606609
D58547FA2A1D12270068ADF4 /* NavigationSplitViewTests.swift in Sources */,
607610
D5F8D5EF2A1E87950054E9AB /* NavigationViewWithColumnsStyleTests.swift in Sources */,
608611
D57506882A27CB9800A628E4 /* FormTests.swift in Sources */,
612+
D55BAD142DFF2B050038443E /* WebViewTests.swift in Sources */,
609613
D58119C82A22AC130081F853 /* ToggleTests.swift in Sources */,
610614
D58119D22A23A77C0081F853 /* StepperTests.swift in Sources */,
611615
D58119DA2A23B7700081F853 /* ColorPickerTests.swift in Sources */,
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#if canImport(WebKit)
2+
import SwiftUI
3+
import SwiftUIIntrospect
4+
import WebKit
5+
import XCTest
6+
7+
@available(iOS 26, tvOS 26, macOS 26, *)
8+
@MainActor
9+
final class WebViewTests: XCTestCase {
10+
typealias PlatformMap = WKWebView
11+
12+
func testWebView() throws {
13+
XCTAssertViewIntrospection(of: PlatformMap.self) { spies in
14+
let spy0 = spies[0]
15+
let spy1 = spies[1]
16+
let spy2 = spies[2]
17+
18+
VStack {
19+
WebView(url: nil)
20+
.introspect(
21+
.map,
22+
on: .iOS(.v26), .tvOS(.v26), .macOS(.v26), .visionOS(.v26),
23+
customize: spy0
24+
)
25+
26+
WebView(url: nil)
27+
.introspect(
28+
.map,
29+
on: .iOS(.v26), .tvOS(.v26), .macOS(.v26), .visionOS(.v26),
30+
customize: spy1
31+
)
32+
33+
WebView(url: nil)
34+
.introspect(
35+
.map,
36+
on: .iOS(.v26), .tvOS(.v26), .macOS(.v26), .visionOS(.v26),
37+
customize: spy2
38+
)
39+
}
40+
} extraAssertions: {
41+
XCTAssertNotIdentical($0[safe: 0], $0[safe: 1])
42+
XCTAssertNotIdentical($0[safe: 0], $0[safe: 2])
43+
XCTAssertNotIdentical($0[safe: 1], $0[safe: 2])
44+
}
45+
}
46+
}
47+
#endif

0 commit comments

Comments
 (0)