HTMLKit icon indicating copy to clipboard operation
HTMLKit copied to clipboard

API consideration

Open Kyle-Ye opened this issue 3 years ago • 3 comments

Why we not using SwiftUI-like "some Content" to constraint body rather using "AnyContent"?

Is there some limitation keeping us away from using it?

Kyle-Ye avatar Jan 16 '22 10:01 Kyle-Ye

Something like

public protocol Content {
    associatedtype Body : Content

    @ContentBuilder var body: Self.Body { get }
}

public protocol Page: GlobalElement {
    @ContentBuilder var body: some Content { get }
}

Kyle-Ye avatar Jan 16 '22 10:01 Kyle-Ye

Thanks for bringing your thoughts into this. If I recall it right, I tried already this approach, but I didn't go well, cause of the pre-rendering. Give me some time to investigate on this and let me come back to you before I can give you a finally answer, okay?

mattesmohr avatar Jan 16 '22 12:01 mattesmohr

What did you find out, @mattesmohr? I'm happy to help with the conversion if this looks like a workable idea.

tonyarnold avatar Jun 20 '22 11:06 tonyarnold