From 72ee67ac703c8c98b3d4778f7a65857f69620c63 Mon Sep 17 00:00:00 2001 From: Simon Leeb <52261246+sliemeobn@users.noreply.github.com> Date: Tue, 17 Mar 2026 10:57:17 +0100 Subject: [PATCH] removed deprecations --- Sources/Elementary/Core/CoreModel.swift | 20 ------------------- Sources/Elementary/Core/Environment.swift | 14 ++----------- Sources/Elementary/Core/Html+Attributes.swift | 4 ---- Sources/Elementary/Core/HtmlBuilder.swift | 11 ---------- Sources/Elementary/Html+Rendering.swift | 6 ------ .../Rendering/HtmlTextRenderer.swift | 9 --------- .../ServerSupport/SendOnceBox.swift | 2 +- .../ServerSupport/SendableAnyHTMLBox.swift | 13 ------------ .../ElementaryTests/SendableAnyHTMLBox.swift | 2 -- 9 files changed, 3 insertions(+), 78 deletions(-) diff --git a/Sources/Elementary/Core/CoreModel.swift b/Sources/Elementary/Core/CoreModel.swift index 24278e7..1c035b7 100644 --- a/Sources/Elementary/Core/CoreModel.swift +++ b/Sources/Elementary/Core/CoreModel.swift @@ -30,11 +30,6 @@ public protocol HTML { /// The HTML content of this component. @HTMLBuilder var body: Body { get } - /// The HTML content of this component. - @HTMLBuilder - @available(*, deprecated, message: "`var content` is deprecated, use `var body` instead") - var content: Body { get } - static func _render( _ html: consuming Self, into renderer: inout Renderer, @@ -50,21 +45,6 @@ public protocol HTML { #endif } -extension HTML { - @available(*, deprecated, message: "`var content` is deprecated, use `var body` instead") - public var body: Body { - // NOTE: sorry for the change - content - } - - @available(*, deprecated, message: "Content was renamed, use Body instead") - public typealias Content = Body - - public var content: Body { - fatalError("Please make sure to add a `var body` implementation to your HTML type.") - } -} - /// A type that represents an HTML tag. public protocol HTMLTagDefinition: Sendable { /// The name of the HTML tag as it is rendered in an HTML document. diff --git a/Sources/Elementary/Core/Environment.swift b/Sources/Elementary/Core/Environment.swift index 0a799de..2fef8b5 100644 --- a/Sources/Elementary/Core/Environment.swift +++ b/Sources/Elementary/Core/Environment.swift @@ -86,12 +86,7 @@ public struct _ModifiedTaskLocal: HTML { into renderer: inout Renderer, with context: consuming _RenderingContext ) { - #if compiler(>=6.0) - // https://github.com/swiftlang/swift/issues/76474 - let context = consume context - #endif - - html.taskLocal.withValue(html.value) { + html.taskLocal.withValue(html.value) { [context] in Content._render(html.wrappedContent, into: &renderer, with: context) } } @@ -102,12 +97,7 @@ public struct _ModifiedTaskLocal: HTML { into renderer: inout Renderer, with context: consuming _RenderingContext ) async throws { - #if compiler(>=6.0) - // https://github.com/swiftlang/swift/issues/76474 - let context = consume context - #endif - - try await html.taskLocal.withValue(html.value) { + try await html.taskLocal.withValue(html.value) { [context] in try await Content._render(html.wrappedContent, into: &renderer, with: context) } } diff --git a/Sources/Elementary/Core/Html+Attributes.swift b/Sources/Elementary/Core/Html+Attributes.swift index 872da00..9a6cad8 100644 --- a/Sources/Elementary/Core/Html+Attributes.swift +++ b/Sources/Elementary/Core/Html+Attributes.swift @@ -25,10 +25,6 @@ public struct HTMLAttributeMergeAction: Sendable { /// Ignores the new value if the attribute already exists. public static var ignoring: Self { .init(mergeMode: .ignoreIfSet) } - /// Appends the new value to the existing value, separated by the specified string. - @available(*, deprecated, renamed: "appending(separatedBy:)") - public static func appending(seperatedBy: String) -> Self { .init(mergeMode: .appendValue(seperatedBy)) } - /// Appends the new value to the existing value, separated by the specified string. public static func appending(separatedBy: String) -> Self { .init(mergeMode: .appendValue(separatedBy)) } } diff --git a/Sources/Elementary/Core/HtmlBuilder.swift b/Sources/Elementary/Core/HtmlBuilder.swift index 1e0d067..4557e44 100644 --- a/Sources/Elementary/Core/HtmlBuilder.swift +++ b/Sources/Elementary/Core/HtmlBuilder.swift @@ -10,11 +10,6 @@ HTMLText(content) } - @available(*, deprecated, message: "use buildExpression(_: String) instead") - public static func buildExpression(_ content: Content) -> HTMLText where Content: StringProtocol { - HTMLText(String(content)) - } - @inlinable public static func buildBlock() -> EmptyHTML { EmptyHTML() @@ -122,12 +117,6 @@ public struct HTMLText: HTML, Sendable { /// The text content. public var text: String - /// Creates a new text content with the specified text. - @available(*, deprecated, message: "use init(_: String) instead") - public init(_ text: some StringProtocol) { - self.text = String(text) - } - /// Creates a new text content with the specified text. @inlinable public init(_ text: String) { diff --git a/Sources/Elementary/Html+Rendering.swift b/Sources/Elementary/Html+Rendering.swift index 9b718ad..7245a52 100644 --- a/Sources/Elementary/Html+Rendering.swift +++ b/Sources/Elementary/Html+Rendering.swift @@ -21,12 +21,6 @@ public extension HTML { return renderer.collect() } - @available(*, deprecated, message: "will be removed, use async API render(into:chunkSize:) instead") - consuming func render(into writer: @escaping (String) -> Void) { - var renderer = HTMLStreamRenderer(writer: writer) - Self._render(self, into: &renderer, with: .emptyContext) - } - /// Renders the HTML content into a stream writer. /// - Parameters: /// - writer: The ``HTMLStreamWriter`` to write the rendered content to. diff --git a/Sources/Elementary/Rendering/HtmlTextRenderer.swift b/Sources/Elementary/Rendering/HtmlTextRenderer.swift index bc3e107..0f6bd77 100644 --- a/Sources/Elementary/Rendering/HtmlTextRenderer.swift +++ b/Sources/Elementary/Rendering/HtmlTextRenderer.swift @@ -20,15 +20,6 @@ struct HTMLTextRenderer: _HTMLRendering { } } -@available(*, deprecated, message: "will be removed") -struct HTMLStreamRenderer: _HTMLRendering { - let writer: (String) -> Void - - mutating func appendToken(_ token: consuming _HTMLRenderToken) { - writer(token.renderedValue()) - } -} - struct PrettyHTMLTextRenderer { let indentation: String diff --git a/Sources/Elementary/ServerSupport/SendOnceBox.swift b/Sources/Elementary/ServerSupport/SendOnceBox.swift index 45f677e..ba85c8c 100644 --- a/Sources/Elementary/ServerSupport/SendOnceBox.swift +++ b/Sources/Elementary/ServerSupport/SendOnceBox.swift @@ -1,4 +1,4 @@ -#if compiler(>=6.0) && !hasFeature(Embedded) +#if !hasFeature(Embedded) import Synchronization @available(iOS 18, macOS 15, *) diff --git a/Sources/Elementary/ServerSupport/SendableAnyHTMLBox.swift b/Sources/Elementary/ServerSupport/SendableAnyHTMLBox.swift index 44619a7..6b25045 100644 --- a/Sources/Elementary/ServerSupport/SendableAnyHTMLBox.swift +++ b/Sources/Elementary/ServerSupport/SendableAnyHTMLBox.swift @@ -10,24 +10,19 @@ public struct _SendableAnyHTMLBox: Sendable { enum Storage { case sendable(any HTML & Sendable) - #if compiler(>=6.0) // NOTE: protocol can be removed when macOS 15 is the minimum case sendOnceBox(any SendOnceBoxing) - #endif } public init(_ html: any HTML & Sendable) { storage = .sendable(html) } - #if compiler(>=6.0) @available(macOS 15, *) public init(_ html: sending any HTML) { storage = .sendOnceBox(SendOnceBox(html)) } - #endif - #if compiler(>=6.0) public consuming func tryTake() -> sending (any HTML)? { switch storage { case let .sendable(html): @@ -36,13 +31,5 @@ public struct _SendableAnyHTMLBox: Sendable { return box.tryTake() } } - #else - public consuming func tryTake() -> (any HTML & Sendable)? { - switch storage { - case let .sendable(html): - return html - } - } - #endif } #endif diff --git a/Tests/ElementaryTests/SendableAnyHTMLBox.swift b/Tests/ElementaryTests/SendableAnyHTMLBox.swift index eac69eb..a514abe 100644 --- a/Tests/ElementaryTests/SendableAnyHTMLBox.swift +++ b/Tests/ElementaryTests/SendableAnyHTMLBox.swift @@ -9,7 +9,6 @@ final class SendOnceHTMLValueTests: XCTestCase { XCTAssertNotNil(box.tryTake()) } - #if compiler(>=6.0) func testHoldsNonSendable() throws { guard #available(macOS 15.0, *) else { throw XCTSkip("Requires macOS 15.0") @@ -20,7 +19,6 @@ final class SendOnceHTMLValueTests: XCTestCase { XCTAssertNotNil(box.tryTake()) XCTAssertNil(box.tryTake()) } - #endif } class NonSendable {