- 最低限の実装
- リストの表示形式
最低限の実装
import SwiftUI
struct ContentView: View {
@State var dummyList: [String] = ["test1", "test2", "test3", "test4", "test5", "test6", "test7"]
var body: some View {
List {
ForEach(dummyList, id:\.self) {list in
HStack {
Text(list).padding(.all)
Spacer()
}
}
.frame(height: 50)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
実行結果