Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Button.swift #4

Merged
merged 1 commit into from Feb 5, 2022
Merged

Update Button.swift #4

merged 1 commit into from Feb 5, 2022

Conversation

bgisme
Copy link
Contributor

@bgisme bgisme commented Feb 5, 2022

When using libraries like Bootstrap, I often need to put child elements inside buttons. But the init() only takes contents.

Not sure if it was intentional. To only allow users to create Buttons with String contents. But I would think all Tags should have a designated init() that allows for children with a builder parameter, whether or not it produces well written HTML. And then the convenience inits would implement preferred or common usage. Like in A.swift where the convenience init() just takes contents.

When using libraries like Bootstrap, I often need to put child elements inside buttons. But the init() only takes contents.

Not sure if it was intentional. To only allow users to create Buttons with String contents. But I would think all Tags should have a designated init() that allows for children with a builder parameter, whether or not it produces well written HTML. And then the convenience inits would implement preferred or common usage. Like in A.swift where the convenience init() just takes contents.
@tib
Copy link
Member

tib commented Feb 5, 2022

I agree, we should extend the Tag class and allow to create children by default for every single tag.

We can mark the init of those elements that can't have child elements with the @available(*, unavailable) attribute.

Give me some time, I'll experiment with this later on today won't merge this until that, since maybe we can have a better solution.

@tib tib merged commit f6e3eeb into BinaryBirds:main Feb 5, 2022
@tib
Copy link
Member

tib commented Feb 5, 2022

I checked the Tag class for a generic init solution, but since it'd require the node it's quite hard to come up with something that would be useful for other subclasses. If we need we can extend other tags as well to support the builder param for now I'm going to merge this PR as it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants