File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Development/Sources/FluidInterfaceKit-Demo/DemoFloatingDisplayKit Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ struct FloatingDisplayKitContentView: View {
2929 context: . init(
3030 position: . top,
3131 transition: . slideIn,
32+ onTap: {
33+ print ( " tap " )
34+ } ,
3235 content: {
3336 ZStack {
3437 HStack {
Original file line number Diff line number Diff line change @@ -39,12 +39,13 @@ extension FloatingDisplayContext {
3939 public convenience init < Content: View > (
4040 position: FloatingDisplayController . DisplayPosition ,
4141 transition: FloatingDisplayTransitionType ,
42+ onTap: @escaping @MainActor ( ) -> Void ,
4243 @ViewBuilder content: @escaping ( ) -> Content
4344 ) {
4445
4546 self . init (
4647 viewBuilder: {
47- _HostingWrapperView ( hostingView: SwiftUIHostingView ( content: content) )
48+ _HostingWrapperView ( hostingView: SwiftUIHostingView ( content: content) , onTap : onTap )
4849 } ,
4950 position: position,
5051 transition: transition
@@ -58,7 +59,7 @@ private final class _HostingWrapperView: SnackbarDraggableBase {
5859
5960 private let hostingView : SwiftUIHostingView
6061
61- init ( hostingView: SwiftUIHostingView ) {
62+ init ( hostingView: SwiftUIHostingView , onTap : @escaping @ MainActor ( ) -> Void ) {
6263 self . hostingView = hostingView
6364 super. init ( topMargin: . zero)
6465 contentView. addSubview ( hostingView)
@@ -69,6 +70,8 @@ private final class _HostingWrapperView: SnackbarDraggableBase {
6970 hostingView. leadingAnchor. constraint ( equalTo: contentView. leadingAnchor) ,
7071 hostingView. trailingAnchor. constraint ( equalTo: contentView. trailingAnchor)
7172 ] )
73+
74+ self . onTap = onTap
7275 }
7376
7477}
You can’t perform that action at this time.
0 commit comments