0

As per apple documentation Instance Property dismiss() is An action that dismisses the current presentation. So I use it inside a NavigationView so that I can remove/pop the current view. Once I pressed this button console shows this log message.

[Scene] Invalid attempt to call -[UIApplication requestSceneSessionDestruction:] from an unsupported device.

Here is this minimum code I have used to generate this message.

import SwiftUI

struct ContentView: View {
    @Environment(\.dismiss) var dismiss
    
    var body: some View {
        NavigationView{
            NavigationLink {
                Button {
                    dismiss()
                } label: {
                    Text("Remove Current Presentation")
                }
            } label: {
                Text("Child View")
            }
        }
    }
}
Qazi Ammar
  • 953
  • 1
  • 8
  • 23

0 Answers0