Saturday, February 3, 2024
HomeiOS Developmentios - The best way to drive .popover to not create vertical...

ios – The best way to drive .popover to not create vertical system padding for Textual content (SwiftUI)


I’m dealing with an issue: I must create a popover with an error message for a textual content discipline. I’m utilizing .popover within the under technique:

                .popover(
                    isPresented: $isValid,
                    attachmentAnchor: .level(.heart),
                    arrowEdge: .backside
                ) {
                    Textual content("Some error textual content")
                        .presentationCompactAdaptation(.popover)
                }

Nonetheless, I get parasitic vertical padding on the high and backside.

Instance 1

But when I take advantage of some sort of illustration with actual dimensions, there aren’t any further insets like with Textual content.

                .popover(
                    isPresented: $isValid,
                    attachmentAnchor: .level(.heart),
                    arrowEdge: .backside
                ) {
                    Rectangle().fill(.yellow)
                        .body(width: 100, peak: 100)
                        .presentationCompactAdaptation(.popover)
                }

Instance 2

I observe the issue solely with Textual content.

I discovered many options on stackoverflow involving bulk Extension’s with customized popover implementations.

However is there an easier resolution? I do not wish to add massive customized implementations to the undertaking purely due to the 2 insets.

I’ve tried a number of choices (for instance, I’ve tried utilizing ScrollView for Textual content) making an attempt to eliminate the vertical padding and make the popover wrap the Textual content to suit the content material, however I have not been capable of.

If anybody is aware of what the difficulty is, please assist me out =)

p.s. goal: ios16



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments