Do not erase types in views when possible

This commit is contained in:
david-swift 2024-03-04 05:57:19 +01:00
parent 9032161985
commit 81a63c40f4
3 changed files with 11 additions and 11 deletions

View File

@ -43,7 +43,7 @@ extension View {
/// - visible: Whether the popover is displayed.
/// - content: The popover's content.
/// - Returns: The view.
public func popover(visible: Binding<Bool>, @ViewBuilder content: @escaping () -> Body) -> View {
public func popover(visible: Binding<Bool>, @ViewBuilder content: @escaping () -> Body) -> Overlay {
overlay {
Popover(visible: visible)
.child(content)

View File

@ -57,8 +57,8 @@ extension View {
/// - title: The title of the toast.
/// - signal: The signal which activates the presentation of a toast.
/// - Returns: A view.
public func toast(_ title: String, signal: Signal) -> View {
ToastOverlay(title, signal: signal)
public func toast(_ title: String, signal: Signal) -> ToastOverlay {
.init(title, signal: signal)
.child { self }
}
@ -69,8 +69,8 @@ extension View {
/// - button: The button's label.
/// - handler: The handler for the button.
/// - Returns: A view.
public func toast(_ title: String, signal: Signal, button: String, handler: @escaping () -> Void) -> View {
ToastOverlay(title, signal: signal)
public func toast(_ title: String, signal: Signal, button: String, handler: @escaping () -> Void) -> ToastOverlay {
.init(title, signal: signal)
.child { self }
.action(button: button, handler: handler)
}

View File

@ -26,8 +26,8 @@ extension View {
/// - toolbar: The toolbar's content.
/// - visible: Whether the toolbar is visible.
/// - Returns: A view.
public func topToolbar(visible: Bool = true, @ViewBuilder _ toolbar: @escaping () -> Body) -> View {
ToolbarView()
public func topToolbar(visible: Bool = true, @ViewBuilder _ toolbar: @escaping () -> Body) -> ToolbarView {
.init()
.content { self }
.top(toolbar)
.revealTopBars(visible)
@ -38,8 +38,8 @@ extension View {
/// - toolbar: The toolbar's content.
/// - visible: Whether the toolbar is visible.
/// - Returns: A view.
public func bottomToolbar(visible: Bool = true, @ViewBuilder _ toolbar: @escaping () -> Body) -> View {
ToolbarView()
public func bottomToolbar(visible: Bool = true, @ViewBuilder _ toolbar: @escaping () -> Body) -> ToolbarView {
.init()
.content { self }
.bottom(toolbar)
.revealBottomBars(visible)
@ -49,8 +49,8 @@ extension View {
/// - Parameters:
/// - overlay: The overlay view.
/// - Returns: A view.
public func overlay(@ViewBuilder _ overlay: @escaping () -> Body) -> View {
Overlay()
public func overlay(@ViewBuilder _ overlay: @escaping () -> Body) -> Overlay {
.init()
.child { self }
.overlay(overlay)
}