Remove arrow in macOS popover using SwiftUI

Is there any solution to remove arrow in popover for macOS?
I'm using SwiftUI to make macOS app.
However, I need a popover which has no arrow.
But, in macOS target project, there is no way to remove arrow from popover.
Code Block
Button(action: {}) {
Text("Button")
}.popover(isPresented: .constant(true), content: {
Text("Popover")
})


Answered by robnotyou in 667277022
A popover without an arrow is possible in UIKit, but not in SwiftUI.

You are using:
Code Block
func popover<Content>(
isPresented: Binding<Bool>,
attachmentAnchor: PopoverAttachmentAnchor = .rect(.bounds),
arrowEdge: Edge = .top,
content: @escaping () -> Content
) -> some View where Content : View

...which is all that SwiftUI provides.
There is no option to hide/remove the arrow, and the "attachmentAnchor" and "arrowEdge" parameters cannot be used to achieve this.

You could investigate wrapping a UIKit solution in a SwiftUI representable view.
Accepted Answer
A popover without an arrow is possible in UIKit, but not in SwiftUI.

You are using:
Code Block
func popover<Content>(
isPresented: Binding<Bool>,
attachmentAnchor: PopoverAttachmentAnchor = .rect(.bounds),
arrowEdge: Edge = .top,
content: @escaping () -> Content
) -> some View where Content : View

...which is all that SwiftUI provides.
There is no option to hide/remove the arrow, and the "attachmentAnchor" and "arrowEdge" parameters cannot be used to achieve this.

You could investigate wrapping a UIKit solution in a SwiftUI representable view.
@robnotyou

I see...
However I'm developing 'macOS target App'. So, there is no way to use UIKit.
Is it right..?
macOS, iOS, the same principle applies when you go beyond what SwiftUI can currently achieve.
  • On iOS you fall back to using a UIKit solution, wrapped in UIViewRepresentable (or UIViewControllerRepresentable).

  • On macOS you fall back to using an AppKit solution, wrapped in NSViewRepresentable (or NSViewControllerRepresentable).

Remove arrow in macOS popover using SwiftUI
 
 
Q