I have a Modal view that seems to overlap the screen of my iPhoneX.
This is DetailView.swift.
import SwiftUI
struct DetailView : View {
@Binding
var shouldDismiss : Bool
var textData : String
var image : UIImage?
@Environment(\.isPresented) private var isPresented
var body: some View {
VStack( alignment: .leading) {
Button(action: {
self.shouldDismiss.toggle()
}) {
Text("Close")
}.font(.title)
.foregroundColor(Color.secondary)
.padding()
Image(uiImage: image ?? UIImage())
.padding()
Text(textData)
.lineLimit(0)
Spacer()
}
}
}This is where the view is being pushed:
ZStack {
...
}.presentation(showDetails ? Modal(DetailView(shouldDismiss: $showDetails, textData: theTxtData, image: theImage), onDismiss:{ self.showDetails = false }) : nil)The DetailView overlaps on both sides of the screen. The text on the close Button is cut off (The "C" is not visible). Same goes for the image and the textData filed.