SwiftUI中Embed in List与Repated(ForEach)的显示问题
今天在学习SwiftUI中遇到一个问题 // // ContentView.swift // FirstSwiftUI // // Created by 胡安华 on 2020/2/20. // Copyright © 2020 胡安华. All rights reserved. // import SwiftUI struct ContentView: View { var dataSource=dataStore var body: some View { NavigationView { List{ //【标示 1】 ForEach(dataSource) { item in //dataSource元素一定要实现接口 Identifiable,也就是要有个唯一键ID NavigationLink(destination:UpdateDetailView(titlets:item.title,description:item.description)) { DataListView(title: item.title, description: item.description) } }.navigationBarTitle(Text("Updates")) } } } } struct ContentView_Previews: PreviewProvider {