Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore Bottom safe area in UIViewController presented from SwiftUI

I have a UIViewController that I am presenting from a SwiftUI view, previously when presenting from UIKit, I wasn't having this issue. The content at the bottom is being cut off for some reason, how can I fix this?

presented like this from a list:

.fullScreenCover(isPresented: $isPresented, onDismiss: nil, content: {
     SingleTakeView(take: take)
})
    struct SingleTakeView: UIViewControllerRepresentable {
        func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
            
        }
        
        var take: TakeOBJ
    
        func makeUIViewController(context: Context) -> UIViewController {
            let singleTakeVC = TakeSingleViewController(nibName: "TakeSingleView", bundle: nil, take: take)
            let nav = UINavigationController(rootViewController: singleTakeVC)
            nav.modalPresentationStyle = .fullScreen
            return nav
        }
    }

like image 730
tHatpart Avatar asked Oct 28 '25 21:10

tHatpart


1 Answers

You need to set the representable to ignore the safe area. You can either choose .vertical or .bottom.

.fullScreenCover(isPresented: $isPresented, onDismiss: nil, content: {
 SingleTakeView(take: take).edgesIgnoringSafeArea(.vertical)

})

like image 70
brokenrhino Avatar answered Oct 31 '25 10:10

brokenrhino



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!