Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Samuel-IH
Copy link

Previously conditionals had to have a trailing "else {...}" at the end because of lack of optional support from the View protocol.
This fix will introduce View optionals and make the behavior more like SwiftUI's View.

Note:
I had to add an optional check inside ComponentReflection.swift, I'm not 100% sure of the inner workings of this file but this doesn't seem to be causing any conflicts.

Previously conditionals had to have a trailing "else {...}" at the end because of lack of optional support from the View protocol.
This fix will introduce View optionals and make the behavior more like SwiftUI's View.

(cherry picked from commit 223bc36)
@helje5
Copy link
Member

helje5 commented Sep 18, 2020

Thanks for your PRs! It'll take me a while to find the time to review the things.

//support for optional Views, mainly for @ViewBuilder convenience
extension Optional : View where Wrapped : View {
public var body: EmptyView {
EmptyView()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better late than never, but that seems wrong. The Optional View should be the wrapped if set, and EmptyView only in the .none case.

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

Successfully merging this pull request may close these issues.

2 participants