I got this error when try to run my code

=> "Value of type 'DismissAction' has no member 'wrappedValue'"

i was trying to learn to how go back to previous root without using back button of navigation bar because i planned to remove it but when i tried my code it doesn't run.

@Environment(\.dismiss) var presentationMode

    var body: some View{

        .frame(width: 150, alignment: .leading)

thank you


If you want to use presentationMode.self.wrappedValue.dismiss(), you have to declare your @Enviroment as @Environment(\.presentationMode).

This error occurred because you are using the wrong type of dismiss().

Also, you could achieve this dismissing in a simpler way by using (\.dismiss) type instead:

  @Environment(\.dismiss) var dismiss //modified
  var body: some View {
    Button("dismiss") {
        dismiss() //modified


async/await、Task 和 [weak self]

iOS 中是否有用于自定义振动的 API?

Swift tableView 分页

以编程方式获取故事板 ID?

如何判断是否为 64 位构建了静态库?

Xcode 4.2 如何将一个项目包含到另一个项目中?

有什么方法可以加粗 NSString 的一部分?


UIView 中的 safeAreaInsets 在 iPhone X 上为 0

ARC - __unsafe_unretained 的含义?

实施 NSCopying


内循环;构建可能会产生不可靠的结果:Xcode 错误

如何在 UITextField 返回键上添加操作?


使用 hitTest:withEvent 捕获其父视图框架之外的子视图的touch :

字符 0 周围的 Alamofire 无效值

如何在 Swift 中将 TextField 添加到 UIAlertController

在 Swift 中将 JSON 字符串转换为 Object 的简单而干净的方法

UIImagePickerController 错误:对尚未渲染的视图进行快照会导致 iOS 7 中的快照为空