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

Commit 81a63c4

Browse files
committed
Do not erase types in views when possible
1 parent 9032161 commit 81a63c4

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Sources/Adwaita/View/Modifiers/Popover+.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extension View {
4343
/// - visible: Whether the popover is displayed.
4444
/// - content: The popover's content.
4545
/// - Returns: The view.
46-
public func popover(visible: Binding<Bool>, @ViewBuilder content: @escaping () -> Body) -> View {
46+
public func popover(visible: Binding<Bool>, @ViewBuilder content: @escaping () -> Body) -> Overlay {
4747
overlay {
4848
Popover(visible: visible)
4949
.child(content)

Sources/Adwaita/View/Modifiers/ToastOverlay+.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ extension View {
5757
/// - title: The title of the toast.
5858
/// - signal: The signal which activates the presentation of a toast.
5959
/// - Returns: A view.
60-
public func toast(_ title: String, signal: Signal) -> View {
61-
ToastOverlay(title, signal: signal)
60+
public func toast(_ title: String, signal: Signal) -> ToastOverlay {
61+
.init(title, signal: signal)
6262
.child { self }
6363
}
6464

@@ -69,8 +69,8 @@ extension View {
6969
/// - button: The button's label.
7070
/// - handler: The handler for the button.
7171
/// - Returns: A view.
72-
public func toast(_ title: String, signal: Signal, button: String, handler: @escaping () -> Void) -> View {
73-
ToastOverlay(title, signal: signal)
72+
public func toast(_ title: String, signal: Signal, button: String, handler: @escaping () -> Void) -> ToastOverlay {
73+
.init(title, signal: signal)
7474
.child { self }
7575
.action(button: button, handler: handler)
7676
}

Sources/Adwaita/View/Modifiers/View+.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ extension View {
2626
/// - toolbar: The toolbar's content.
2727
/// - visible: Whether the toolbar is visible.
2828
/// - Returns: A view.
29-
public func topToolbar(visible: Bool = true, @ViewBuilder _ toolbar: @escaping () -> Body) -> View {
30-
ToolbarView()
29+
public func topToolbar(visible: Bool = true, @ViewBuilder _ toolbar: @escaping () -> Body) -> ToolbarView {
30+
.init()
3131
.content { self }
3232
.top(toolbar)
3333
.revealTopBars(visible)
@@ -38,8 +38,8 @@ extension View {
3838
/// - toolbar: The toolbar's content.
3939
/// - visible: Whether the toolbar is visible.
4040
/// - Returns: A view.
41-
public func bottomToolbar(visible: Bool = true, @ViewBuilder _ toolbar: @escaping () -> Body) -> View {
42-
ToolbarView()
41+
public func bottomToolbar(visible: Bool = true, @ViewBuilder _ toolbar: @escaping () -> Body) -> ToolbarView {
42+
.init()
4343
.content { self }
4444
.bottom(toolbar)
4545
.revealBottomBars(visible)
@@ -49,8 +49,8 @@ extension View {
4949
/// - Parameters:
5050
/// - overlay: The overlay view.
5151
/// - Returns: A view.
52-
public func overlay(@ViewBuilder _ overlay: @escaping () -> Body) -> View {
53-
Overlay()
52+
public func overlay(@ViewBuilder _ overlay: @escaping () -> Body) -> Overlay {
53+
.init()
5454
.child { self }
5555
.overlay(overlay)
5656
}

0 commit comments

Comments
 (0)