Skip to content

Commit f537ab5

Browse files
committed
Remove deprecation warnings for the new Text based elements API for SwiftUI conformance
1 parent 6d3a8a8 commit f537ab5

File tree

17 files changed

+193
-697
lines changed

17 files changed

+193
-697
lines changed

SWIFT_API_COMPLIANCE_REVIEW.md

Lines changed: 0 additions & 176 deletions
This file was deleted.

Sources/WebUI/Elements/Text/Link.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public struct Link: Element {
3737
/// ```
3838
public init(
3939
_ title: String,
40-
destination: String,
40+
to destination: String,
4141
newTab: Bool? = nil,
4242
id: String? = nil,
4343
classes: [String]? = nil,
@@ -57,6 +57,9 @@ public struct Link: Element {
5757

5858
/// Creates a new HTML anchor link using HTMLBuilder closure syntax.
5959
///
60+
/// This allows more complex Link generation, for example if you require
61+
/// an icon before or after your link text.
62+
///
6063
/// - Parameters:
6164
/// - to: URL or path the link points to.
6265
/// - newTab: Opens in a new tab if true, optional.
@@ -73,7 +76,6 @@ public struct Link: Element {
7376
/// "Visit Example Website"
7477
/// }
7578
/// ```
76-
@available(*, deprecated, message: "Use Link(_:destination:) string initializer instead for better SwiftUI compatibility. Example: Link(\"Visit Example\", destination: \"https://example.com\")")
7779
public init(
7880
to destination: String,
7981
newTab: Bool? = nil,

Tests/WebUITests/Core/DocumentTests.swift

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct NoDescriptionDocument: Document {
1616
}
1717

1818
var body: some HTML {
19-
Text { "Test content" }
19+
Text("Test content")
2020
}
2121
}
2222

@@ -32,7 +32,7 @@ struct BasicTestDocument: Document {
3232
}
3333

3434
var body: some HTML {
35-
Text { "Hello, world!" }
35+
Text("Hello, world!")
3636
}
3737
}
3838

@@ -56,7 +56,7 @@ struct FullMetadataDocument: Document {
5656
}
5757

5858
var body: some HTML {
59-
Text { "Content" }
59+
Text("Content")
6060
}
6161
}
6262

@@ -76,7 +76,7 @@ struct FaviconTestDocument: Document {
7676
}
7777

7878
var body: some HTML {
79-
Text { "Favicon Test" }
79+
Text("Favicon Test")
8080
}
8181
}
8282

@@ -98,7 +98,7 @@ struct StructuredDataDocument: Document {
9898
}
9999

100100
var body: some HTML {
101-
Text { "Structured Data Test" }
101+
Text("Structured Data Test")
102102
}
103103
}
104104

@@ -122,7 +122,7 @@ struct ScriptTestDocument: Document {
122122
}
123123

124124
var body: some HTML {
125-
Text { "Script Test" }
125+
Text("Script Test")
126126
}
127127
}
128128

@@ -143,7 +143,7 @@ struct StylesheetTestDocument: Document {
143143
}
144144

145145
var body: some HTML {
146-
Text { "Stylesheet Test" }
146+
Text("Stylesheet Test")
147147
}
148148
}
149149

@@ -164,7 +164,7 @@ struct CustomHeadDocument: Document {
164164
}
165165

166166
var body: some HTML {
167-
Text { "Custom Head Test" }
167+
Text("Custom Head Test")
168168
}
169169
}
170170

@@ -338,3 +338,4 @@ struct DocumentTests {
338338
#expect(rendered.contains("<style>body { color: red; }</style>"))
339339
}
340340
}
341+

0 commit comments

Comments
 (0)