swift 导航链接错误(来自YT视频)

rwqw0loc  于 2022-12-10  发布在  Swift
关注(0)|答案(1)|浏览(132)

我是按照这个教程(https://www.youtube.com/watch?v=GiCTgsH0dtk),并得到了这个错误,任何人都知道一个工作周围的其他人在评论中有麻烦与同样的事情,所以我认为id帮助
您知道处理这段代码的新错误的正确方法吗?

NavigationLink(destination: SignUp(show: self.$show), isActive: self.$show) {
                            
                            Text("")
                        }
                        .hidden()
                        
                        Login(show: self.$show)
                    }

错误:
“init(destination:isActive:label:)”在iOS 16.0中已弃用:在导航堆栈或导航拆分视图中使用导航链接(值:标签:)

h7appiyu

h7appiyu1#

First, change your NavigationLink to NavigationStack . And lastly, where your - if you have one - .navigationTitle("") goes (this is where NavigationView closes), Xcode is asking you to add a .navigationDestination() as following:

.navigationDestination(isPresented: $show) {
                        //Whatever View you want to display...
}

This alert, not error, happens because of iOS 16 and Apple's constant changes on the Swift and Swift's frameworks changes.

相关问题