在xcode 12(swift 5.3)中,我使用条件NavigationLink导航到另一个navigationView,以使用NavigationLink列出coreData对象。但是似乎AnotherView的NavigationTitle不能正确显示在屏幕顶部,而是填充到顶部。另一个navigationView中的列表具有外部白色背景色。我想传递给SomethingView报告Argument passed to call that takes no arguments
错误的something.id,但是我可以在Text中获得something.name。
struct StartView: View {
@State var changeToAnotherView: String? = nil
var body: some View {
NavigationView {
VStack(spacing: 20) {
...
NavigationLink(destination: AnotherView(), tag: "AnotherView",
selection: $changeToAnotherView) { EmptyView() }
}
}
}
}
struct AnotherView: View {
@Environment(\.managedObjectContext) var moc
@FetchRequest(entity: Something.entity(), sortDescriptors: []) var somethings: FetchedResults<Something>
...
var body: some View {
NavigationView {
List {
ForEach(self.somethings, id: \.id) { something in
NavigationLink(destination: SomethingView(somethingID: something.id)) {
Text(something.name ?? "unknown name")
}
}
}
.navigationBarTitle("SomethingList")
}
}
}
答案 0 :(得分:1)
您不需要第二个val seed: org.kethereum.bip32.model.Seed = MnemonicWords(VALID_MNEMONIC_15).toSeed()
val derivedKey = seed.toKey("m/")
assertThat(derivedKey.serialize()).isEqualTo(XPRV_OF_MNEMONIC_15)
-在视图层次结构中它只能是一个,而且最好通过引用传递CoreData对象(视图将能够观察到它),所以
NavigationView