-
Notifications
You must be signed in to change notification settings - Fork 21
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
Ambiguous use of 'buildBlock' #132
Comments
Oh true, this one. I have encountered it multiple times too, but I couldn't fixed without breaking other things. I went nuts. I was hoping I come up with an idea someday. I wanted to tackle this one after I am done with the components, but let me see if I can fix it for good at the weekend. Maybe the new changes of the result builder and new parameter packs, can help me with it. |
If I recall correctly, the result builder doesn't like it that way: Nav {
Anchor { … }
if let authenticatedUser = context.authenticatedUser {
Div { … }
}
} But the opposite way is fine: Nav {
if let authenticatedUser = context.authenticatedUser {
Div { … }
}
Anchor { … }
} So what I did for the moment, is wrapping the if statement in another element. Nav {
Div {
if let authenticatedUser = context.authenticatedUser {
Div { … }
}
}
Anchor { … }
} Hope it helps, till I found a solution. Fingers crossed. |
I'm seeing the same thing for an if statement at the root of a body. Is there a workaround for that that you know about? (I don't want the body to render anything unless a certain condition is met). |
Oh, that's new to me. But I suspect it has something to do, that Body expects a result of [BodyElement]. And the statement returns [Content]. Use the Custom as a workaround. Custom(name: "body") {
} I will open a issue for it separately. |
Should be fixed by now. I close the issue. |
I'm seeing quite a few instances where I use an
if let
unwrap within the body of a View where Swift can't make up it's mind about which method to use:For instance:
results in:
The text was updated successfully, but these errors were encountered: