diff --git a/README.md b/README.md index 752a60d..86ae898 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,5 @@ The last one is the best for my needs. The goal right now is to produce. Some questions persist. + +Fix ZStack size : https://stackoverflow.com/questions/77969499/content-in-a-full-screen-zstack-not-centering-as-expected diff --git a/macamera/ContentView.swift b/macamera/ContentView.swift index a563626..3dd5f08 100644 --- a/macamera/ContentView.swift +++ b/macamera/ContentView.swift @@ -12,14 +12,15 @@ struct ContentView: View { @State private var capturedImage: UIImage? var body: some View { - - if capturedImage == nil { - CustomCameraView(capturedImage: $capturedImage) - .ignoresSafeArea() - } else { - PhotoPreviewView(capturedImage: $capturedImage) - .ignoresSafeArea() + ZStack { + if capturedImage == nil { + CustomCameraView(capturedImage: $capturedImage) + } else { + PhotoPreviewView(capturedImage: $capturedImage) + } } + .frame(maxWidth: .infinity, maxHeight: .infinity) + .ignoresSafeArea(edges: [.top, .bottom]) } } diff --git a/macamera/PhotoPreviewView.swift b/macamera/PhotoPreviewView.swift index 6fe0fae..aeb8441 100644 --- a/macamera/PhotoPreviewView.swift +++ b/macamera/PhotoPreviewView.swift @@ -28,7 +28,6 @@ struct PhotoPreviewView: View { .padding(.leading, 42) .padding(.top, 62) } - .ignoresSafeArea() } } }