问题描述
我正在学习关于
我知道 Xcode 处于测试阶段,但我在哪里可以找到这些神秘代码的文档?到目前为止,本教程已经很棒了,但我不确定这个 List
和 Array
在做什么.
identified
现在已不再使用.您可以尝试以下语法.
列表{ForEach(landmarkData, id: \.id) { 地标在文字(地标.地名)}}
I'm working through Apple's SwiftUI tutorial on building lists and navigation, and I can't seem to find any documentation for this List
initializer, or the identified(by:)
method of the Array
type:
struct LandmarkList: View {
var body: some View {
List(landmarkData.identified(by: \.id)) { landmark in
}
}
}
When I right-click on the List
initializer and click Jump to Definition
in Xcode, it takes me to this initializer which isn't right. When I do the same for the identified(by:)
method, it takes me to this strange file, which only has 13 lines and no mention of the identified(by:)
method:
I know Xcode is in beta, but where can I find the documentation for these mysterious bits of code? The tutorial has been great up to this point, but I'm not certain what this List
and Array
are doing.
identified
is no more in use now. You may try below syntax.
List{
ForEach(landmarkData, id: \.id) { landmark in
Text(landmark.placeName)
}
}
这篇关于带有标识的 SwiftUI 列表初始值设定项(由 :)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!