// List列表布局
struct ContentView: View {
// let languages = ["Objective-C","Swift","C++","Php"]
@State var languages = ["Objective-C", "Swift", "C++", "Php"]
var body: some View {
// List(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { item in
// Text("Hello World")
// }
// List
// {
// Text("Hello World")
// Text("Hello World")
// Text("Hello World")
// }
// List
// {
// ForEach(languages,id:\.self)
// {language in
// Text(language)
// }
// }
NavigationView // 导航视图
{
List {
ForEach(languages, id: \.self) { language in
Text(language)
}
//
SwiftUI初级课程(二十七)List布局添加、删除、移动
最新推荐文章于 2024-05-20 08:52:35 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)