所以我想使用SwiftUI呈现一个新视图,而用户不必点击按钮,因为NavigationButton可以使用它。这是一个例子
struct ContentView : View {
var model: Model
var body: some View {
NavigationView {
Text("Hello World")
}.onAppear {
if model.shouldPresent {
// present a new view
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
在onAppearI中,我想包含一些将新视图推送到导航堆栈的代码。
当我在代码中添加断点时,我尝试执行po某些操作,lldb一次出现此错误,并在再次打印变量后消失。
warning: Swift error in fallback scratch context: error: failed to load module 'AppName'
note: This error message is displayed only once. If the error displayed above is due to conflicting
search paths to Clang modules in different images of the debugged executable,
this can slow down debugging of Swift code significantly,
since a fresh Swift context has to be created every time a conflict is encountered.
Run Code Online (Sandbox Code Playgroud) 我正在尝试使我的可移动,但它需要协议中tableView cells的 2 或 3 个功能,如果我尝试在我的中实现委托,它将要求新的.UITableViewDataSourceviewControllernumberOfRowsInSectioncellForRowAtIndexPathUITableViewDiffableDataSource
在使用 new 时如何实现这种行为UITableViewDiffableDataSource?