Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Sources/Elementary/Core/HtmlBuilder+Tuples.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public extension HTMLBuilder {
// variadic generics currently not supported in embedded
#if !hasFeature(Embedded)
@inlinable
@available(iOS 17, *)
static func buildBlock<each Content>(_ content: repeat each Content) -> _HTMLTuple<repeat each Content>
where repeat each Content: HTML {
_HTMLTuple(repeat each content)
Expand Down Expand Up @@ -273,8 +274,10 @@ public struct _HTMLTuple6<V0: HTML, V1: HTML, V2: HTML, V3: HTML, V4: HTML, V5:

// variadic generics currently not supported in embedded
#if !hasFeature(Embedded)
@available(iOS 17, *)
extension _HTMLTuple: Sendable where repeat each Child: Sendable {}

@available(iOS 17, *)
public struct _HTMLTuple<each Child: HTML>: HTML {
public let value: (repeat each Child)

Expand Down
8 changes: 8 additions & 0 deletions Sources/Elementary/Rendering/HtmlTextRenderer.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if os(iOS)
import Foundation
#endif

#if !hasFeature(Embedded)
struct HTMLTextRenderer: _HTMLRendering {
private var result: [UInt8] = []
Expand Down Expand Up @@ -68,7 +72,11 @@ struct PrettyHTMLTextRenderer {
}

if currentInlineText.contains("\n") {
#if os(iOS)
currentInlineText = currentInlineText.replacingOccurrences(of: "\n", with: "\n\(currentIndentation)")
#else
currentInlineText.replace("\n", with: "\n\(currentIndentation)")
#endif
addLineBreak()
result += currentInlineText
return true
Expand Down
4 changes: 2 additions & 2 deletions Sources/Elementary/ServerSupport/SendOnceBox.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#if compiler(>=6.0) && !hasFeature(Embedded) && !os(iOS)
#if compiler(>=6.0) && !hasFeature(Embedded)
import Synchronization

@available(macOS 15.0, *)
@available(iOS 18, macOS 15, *)
final class SendOnceBox: Sendable, SendOnceBoxing {
// final class SendOnceBox<Value>: Sendable, SendOnceBoxing {
typealias Value = any HTML
Expand Down
4 changes: 3 additions & 1 deletion Sources/Elementary/ServerSupport/SendableAnyHTMLBox.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#if !hasFeature(Embedded) && !os(iOS)
#if !hasFeature(Embedded)
/// A wrapper around an `any HTML` value that can be safely sent once.
///
/// Note: For non-sendable values, this will only allow the value to be taken only once.
/// Sendable values can safely be taken multiple times.

@available(iOS 18, *)
public struct _SendableAnyHTMLBox: Sendable {
var storage: Storage

Expand Down