Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Improve view builder function for optionals
Browse files Browse the repository at this point in the history
  • Loading branch information
david-swift committed Feb 18, 2024
1 parent 279219e commit b00b743
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Sources/Adwaita/Model/User Interface/View/ViewBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ public enum ViewBuilder {
/// - Returns: A nonoptional component.
public static func buildOptional(_ component: Component?) -> Component {
.element(
VStack {
if let component {
buildFinalResult(component)
} else {
[]
Bin()
.child {
if let component {
buildFinalResult(component)
} else {
[]
}
}
}
.visible(component != nil)
.visible(component != nil)
)
}

Expand Down

0 comments on commit b00b743

Please sign in to comment.